Skip to content

Commit c73aa41

Browse files
committed
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: d3e3b7e ("afs: Add metadata xattrs") Signed-off-by: David Howells <[email protected]>
1 parent c0abbb5 commit c73aa41

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

fs/afs/xattr.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ static int afs_xattr_get_cell(const struct xattr_handler *handler,
5050
return namelen;
5151
if (namelen > size)
5252
return -ERANGE;
53-
memcpy(buffer, cell->name, size);
53+
memcpy(buffer, cell->name, namelen);
5454
return namelen;
5555
}
5656

@@ -104,7 +104,7 @@ static int afs_xattr_get_volume(const struct xattr_handler *handler,
104104
return namelen;
105105
if (namelen > size)
106106
return -ERANGE;
107-
memcpy(buffer, volname, size);
107+
memcpy(buffer, volname, namelen);
108108
return namelen;
109109
}
110110

0 commit comments

Comments
 (0)