linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Stephen Smalley <stephen.smalley.work@gmail.com>
To: linux-fsdevel@vger.kernel.org
Cc: Stephen Smalley <stephen.smalley.work@gmail.com>,
	Collin Funk <collin.funk1@gmail.com>,
	Paul Eggert <eggert@cs.ucla.edu>
Subject: [PATCH] fs/xattr.c: fix simple_xattr_list()
Date: Thu,  5 Jun 2025 12:51:16 -0400	[thread overview]
Message-ID: <20250605165116.2063-1-stephen.smalley.work@gmail.com> (raw)

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


             reply	other threads:[~2025-06-05 16:51 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-05 16:51 Stephen Smalley [this message]
2025-06-05 17:09 ` [PATCH] fs/xattr.c: fix simple_xattr_list() Collin Funk
     [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   ` 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250605165116.2063-1-stephen.smalley.work@gmail.com \
    --to=stephen.smalley.work@gmail.com \
    --cc=collin.funk1@gmail.com \
    --cc=eggert@cs.ucla.edu \
    --cc=linux-fsdevel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).