mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-08-25 10:19:47 +00:00
afs: Fix the afs.cell and afs.volume xattr handlers
Fix the ->get handlers for the afs.cell and afs.volume xattrs to pass the
source data size to memcpy() rather than target buffer size.
Overcopying the source data occasionally causes the kernel to oops.
Fixes: d3e3b7eac8
("afs: Add metadata xattrs")
Signed-off-by: David Howells <dhowells@redhat.com>
This commit is contained in:
parent
c0abbb5791
commit
c73aa4102f
1 changed files with 2 additions and 2 deletions
|
@ -50,7 +50,7 @@ static int afs_xattr_get_cell(const struct xattr_handler *handler,
|
|||
return namelen;
|
||||
if (namelen > size)
|
||||
return -ERANGE;
|
||||
memcpy(buffer, cell->name, size);
|
||||
memcpy(buffer, cell->name, namelen);
|
||||
return namelen;
|
||||
}
|
||||
|
||||
|
@ -104,7 +104,7 @@ static int afs_xattr_get_volume(const struct xattr_handler *handler,
|
|||
return namelen;
|
||||
if (namelen > size)
|
||||
return -ERANGE;
|
||||
memcpy(buffer, volname, size);
|
||||
memcpy(buffer, volname, namelen);
|
||||
return namelen;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue