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

Stephen Smalley <stephen.smalley.work@gmail.com> writes:

> 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)) {

Thanks for looking into it and the quick patch.

I'll see if I can test it later today.

Collin

  reply	other threads:[~2025-06-05 17:09 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-05 16:51 [PATCH] fs/xattr.c: fix simple_xattr_list() Stephen Smalley
2025-06-05 17:09 ` Collin Funk [this message]
     [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=m1wm9qund4.fsf@gmail.com \
    --to=collin.funk1@gmail.com \
    --cc=eggert@cs.ucla.edu \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=stephen.smalley.work@gmail.com \
    /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).