Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c73aa410 authored by David Howells's avatar David Howells
Browse files

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: d3e3b7ea ("afs: Add metadata xattrs")
Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
parent c0abbb57
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -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;
}