linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] fs/xattr.c: fix simple_xattr_list()
@ 2025-06-05 16:51 Stephen Smalley
  2025-06-05 17:09 ` Collin Funk
  0 siblings, 1 reply; 12+ messages in thread
From: Stephen Smalley @ 2025-06-05 16:51 UTC (permalink / raw)
  To: linux-fsdevel; +Cc: Stephen Smalley, Collin Funk, Paul Eggert

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>
---
 fs/xattr.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/fs/xattr.c b/fs/xattr.c
index 8ec5b0204bfd..600ae97969cf 100644
--- a/fs/xattr.c
+++ b/fs/xattr.c
@@ -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)) {
-- 
2.49.0


^ permalink raw reply related	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2025-06-17  0:27 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20250605164852.2016-1-stephen.smalley.work@gmail.com>
     [not found] ` <CAHC9VhQ-f-n+0g29MpBB3_om-e=vDqSC3h+Vn_XzpK2zpqamdQ@mail.gmail.com>
2025-06-05 21:51   ` [PATCH] fs/xattr.c: fix simple_xattr_list() Paul Moore
2025-06-06  5:39     ` Collin Funk
2025-06-10 23:50       ` Paul Moore
2025-06-11 10:05         ` Christian Brauner
2025-06-11 15:45           ` Paul Moore
2025-06-12 12:21             ` Christian Brauner
2025-06-12 12:54               ` Stephen Smalley
2025-06-16 14:03           ` Paul Moore
2025-06-16 14:13             ` Christian Brauner
2025-06-17  0:27               ` Collin Funk
2025-06-05 16:51 Stephen Smalley
2025-06-05 17:09 ` Collin Funk

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).