]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
fs/xattr.c: fix simple_xattr_list()
authorStephen Smalley <stephen.smalley.work@gmail.com>
Thu, 5 Jun 2025 16:51:16 +0000 (12:51 -0400)
committerChristian Brauner <brauner@kernel.org>
Fri, 6 Jun 2025 08:00:17 +0000 (10:00 +0200)
commit 8b0ba61df5a1 ("fs/xattr.c: fix simple_xattr_list to always
include security.* xattrs") failed to reset err after the call to
security_inode_listsecurity(), which returns the length of the
returned xattr name. This results in simple_xattr_list() incorrectly
returning this length even if a POSIX acl is also set on the inode.

Reported-by: Collin Funk <collin.funk1@gmail.com>
Closes: https://lore.kernel.org/selinux/8734ceal7q.fsf@gmail.com/
Reported-by: Paul Eggert <eggert@cs.ucla.edu>
Closes: https://bugzilla.redhat.com/show_bug.cgi?id=2369561
Fixes: 8b0ba61df5a1 ("fs/xattr.c: fix simple_xattr_list to always include security.* xattrs")
Signed-off-by: Stephen Smalley <stephen.smalley.work@gmail.com>
Link: https://lore.kernel.org/20250605165116.2063-1-stephen.smalley.work@gmail.com
Signed-off-by: Christian Brauner <brauner@kernel.org>
fs/xattr.c

index 8ec5b0204bfdc587e7875893e3b1a1e1479d7d1b..600ae97969cf241c0827907aff79c5325e935a11 100644 (file)
@@ -1479,6 +1479,7 @@ ssize_t simple_xattr_list(struct inode *inode, struct simple_xattrs *xattrs,
                buffer += err;
        }
        remaining_size -= err;
+       err = 0;
 
        read_lock(&xattrs->lock);
        for (rbp = rb_first(&xattrs->rb_root); rbp; rbp = rb_next(rbp)) {