Skip to content

Commit f4c7914

Browse files
dhowellstorvalds
authored andcommittedNov 3, 2020
afs: Fix incorrect freeing of the ACL passed to the YFS ACL store op
The cleanup for the yfs_store_opaque_acl2_operation calls the wrong function to destroy the ACL content buffer. It's an afs_acl struct, not a yfs_acl struct - and the free function for latter may pass invalid pointers to kfree(). Fix this by using the afs_acl_put() function. The yfs_acl_put() function is then no longer used and can be removed. general protection fault, probably for non-canonical address 0x7ebde00000000: 0000 [#1] SMP PTI ... RIP: 0010:compound_head+0x0/0x11 ... Call Trace: virt_to_cache+0x8/0x51 kfree+0x5d/0x79 yfs_free_opaque_acl+0x16/0x29 afs_put_operation+0x60/0x114 __vfs_setxattr+0x67/0x72 __vfs_setxattr_noperm+0x66/0xe9 vfs_setxattr+0x67/0xce setxattr+0x14e/0x184 __do_sys_fsetxattr+0x66/0x8f do_syscall_64+0x2d/0x3a entry_SYSCALL_64_after_hwframe+0x44/0xa9 Fixes: e49c7b2 ("afs: Build an abstraction around an "operation" concept") Signed-off-by: David Howells <dhowells@redhat.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent c80afa1 commit f4c7914

File tree

1 file changed

+1
-6
lines changed

1 file changed

+1
-6
lines changed
 

‎fs/afs/xattr.c

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -148,11 +148,6 @@ static const struct xattr_handler afs_xattr_afs_acl_handler = {
148148
.set = afs_xattr_set_acl,
149149
};
150150

151-
static void yfs_acl_put(struct afs_operation *op)
152-
{
153-
yfs_free_opaque_acl(op->yacl);
154-
}
155-
156151
static const struct afs_operation_ops yfs_fetch_opaque_acl_operation = {
157152
.issue_yfs_rpc = yfs_fs_fetch_opaque_acl,
158153
.success = afs_acl_success,
@@ -246,7 +241,7 @@ static int afs_xattr_get_yfs(const struct xattr_handler *handler,
246241
static const struct afs_operation_ops yfs_store_opaque_acl2_operation = {
247242
.issue_yfs_rpc = yfs_fs_store_opaque_acl2,
248243
.success = afs_acl_success,
249-
.put = yfs_acl_put,
244+
.put = afs_acl_put,
250245
};
251246

252247
/*

0 commit comments

Comments
 (0)
Please sign in to comment.