Skip to content

Commit

Permalink
afs: Fix the afs.cell and afs.volume xattr handlers
Browse files Browse the repository at this point in the history
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: d3e3b7e ("afs: Add metadata xattrs")
Signed-off-by: David Howells <dhowells@redhat.com>
  • Loading branch information
David Howells committed May 7, 2019
1 parent c0abbb5 commit c73aa41
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions fs/afs/xattr.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down Expand Up @@ -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;
}

Expand Down

0 comments on commit c73aa41

Please sign in to comment.