Skip to contentSkip to conversation

fs/xattr.c: fix simple_xattr_list()

PATCH In review Stephen Smalley 4 participants 12 messages Jun 5, 2025 – Jun 17, 2025

Subsystems (2)
lore
Share & tools
lore

Stephen Smalley

author maintainer
#0 lore raw

PATCH 1/1 fs/xattr.c: fix simple_xattr_list()

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.

Fixes 8b0ba61df5a1 ("fs/xattr.c: fix simple_xattr_list to always include security.* xattrs")
---
 fs/xattr.c | 1 +
 1 file changed, 1 insertion(+)
fs/xattr.c +1 -0
index 8ec5b0204bfd..600ae97969cf 100644
@@ -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)) {
Signature · 1 line
2.49.0
maintainer Reviewed-by on v1 1/1
#1 lore raw
Quoted 13 lines · Stephen Smalley

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.

Fixes 8b0ba61df5a1 ("fs/xattr.c: fix simple_xattr_list to always include security.* xattrs")
Quoted 4 lines
---
 fs/xattr.c | 1 +
 1 file changed, 1 insertion(+)
Quoted 14 lines
fs/xattr.c +1 -1
index 8ec5b0204bfd..600ae97969cf 100644
@@ -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

Signature · 1 line
paul-moore.com
maintainer
#2 lore raw
Quoted 15 lines · Paul Moore
Quoted 13 lines · Stephen Smalley

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.

Fixes 8b0ba61df5a1 ("fs/xattr.c: fix simple_xattr_list to always include security.* xattrs")
Quoted 6 lines
Quoted 4 lines
---
 fs/xattr.c | 1 +
 1 file changed, 1 insertion(+)

Resending this as it appears that Stephen's original posting had a typo in the VFS mailing list. The original post can be found in the SELinux archives:

https://lore.kernel.org/selinux/[email protected]/

Quoted 14 lines
Quoted 14 lines
fs/xattr.c +1 -1
index 8ec5b0204bfd..600ae97969cf 100644
@@ -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

Signature · 1 line
paul-moore.com
Reviewed-by Tested-by
#3 lore raw
Quoted 19 lines · Paul Moore
Quoted 19 lines
Quoted 17 lines · <[email protected]> wrote:

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.

Fixes 8b0ba61df5a1 ("fs/xattr.c: fix simple_xattr_list to always include security.* xattrs")
---
 fs/xattr.c | 1 +
 1 file changed, 1 insertion(+)
Quoted 7 lines
Quoted 1 line

Resending this as it appears that Stephen's original posting had a typo in the VFS mailing list. The original post can be found in the SELinux archives:

https://lore.kernel.org/selinux/[email protected]/

Hi, responding to this message since it has the correct lists.

I just booted into a kernel with this patch applied and confirm that it fixes the Gnulib tests that were failing.

Thanks for the fix.

Collin

maintainer
#4 lore raw
Quoted 30 lines · Collin Funk
Quoted 19 lines · Paul Moore
Quoted 19 lines
Quoted 17 lines · <[email protected]> wrote:

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.

Fixes 8b0ba61df5a1 ("fs/xattr.c: fix simple_xattr_list to always include security.* xattrs")
---
 fs/xattr.c | 1 +
 1 file changed, 1 insertion(+)
Quoted 7 lines
Quoted 1 line

Resending this as it appears that Stephen's original posting had a typo in the VFS mailing list. The original post can be found in the SELinux archives:

https://lore.kernel.org/selinux/[email protected]/

Hi, responding to this message since it has the correct lists.

Quoted 7 lines

I just booted into a kernel with this patch applied and confirm that it fixes the Gnulib tests that were failing.

Thanks for the fix.

Al, Christian, are either of you going to pick up this fix to send to Linus? If not, any objection if I send this up?

Signature · 1 line
paul-moore.com
#5 lore raw
Quoted 34 lines · Paul Moore
Quoted 33 lines · Collin Funk
Quoted 19 lines · Paul Moore
Quoted 19 lines
Quoted 17 lines · <[email protected]> wrote:

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.

Fixes 8b0ba61df5a1 ("fs/xattr.c: fix simple_xattr_list to always include security.* xattrs")
---
 fs/xattr.c | 1 +
 1 file changed, 1 insertion(+)
Quoted 7 lines
Quoted 1 line

Resending this as it appears that Stephen's original posting had a typo in the VFS mailing list. The original post can be found in the SELinux archives:

https://lore.kernel.org/selinux/[email protected]/

Hi, responding to this message since it has the correct lists.

I just booted into a kernel with this patch applied and confirm that it fixes the Gnulib tests that were failing.

Quoted 7 lines
Quoted 4 lines

Thanks for the fix.

Al, Christian, are either of you going to pick up this fix to send to Linus? If not, any objection if I send this up?

It's been in vfs.fixes for some time already and it'll go out with the first round of post -rc1 fixes this week.

maintainer
#6 lore raw
Quoted 39 lines · Christian Brauner
Quoted 37 lines · Paul Moore
Quoted 36 lines · Collin Funk
Quoted 19 lines · Paul Moore
Quoted 19 lines
Quoted 17 lines · <[email protected]> wrote:

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.

Fixes 8b0ba61df5a1 ("fs/xattr.c: fix simple_xattr_list to always include security.* xattrs")
---
 fs/xattr.c | 1 +
 1 file changed, 1 insertion(+)
Quoted 7 lines
Quoted 1 line

Resending this as it appears that Stephen's original posting had a typo in the VFS mailing list. The original post can be found in the SELinux archives:

https://lore.kernel.org/selinux/[email protected]/

Hi, responding to this message since it has the correct lists.

I just booted into a kernel with this patch applied and confirm that it fixes the Gnulib tests that were failing.

Quoted 7 lines
Quoted 4 lines
Quoted 1 line

Thanks for the fix.

Al, Christian, are either of you going to pick up this fix to send to Linus? If not, any objection if I send this up?

It's been in vfs.fixes for some time already and it'll go out with the first round of post -rc1 fixes this week.

Great, thanks. I didn't see any replies on-list indicating that the patch had been picked up, so I just wanted to make sure someone was sending this up to Linus.

Signature · 1 line
paul-moore.com
#7 lore raw
Quoted 42 lines · Paul Moore
Quoted 41 lines · Christian Brauner
Quoted 39 lines · Paul Moore
Quoted 37 lines · Collin Funk
Quoted 19 lines · Paul Moore
Quoted 19 lines
Quoted 17 lines · <[email protected]> wrote:

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.

Fixes 8b0ba61df5a1 ("fs/xattr.c: fix simple_xattr_list to always include security.* xattrs")
---
 fs/xattr.c | 1 +
 1 file changed, 1 insertion(+)
Quoted 7 lines
Quoted 1 line

Resending this as it appears that Stephen's original posting had a typo in the VFS mailing list. The original post can be found in the SELinux archives:

https://lore.kernel.org/selinux/[email protected]/

Hi, responding to this message since it has the correct lists.

I just booted into a kernel with this patch applied and confirm that it fixes the Gnulib tests that were failing.

Thanks for the fix.

Quoted 8 lines
Quoted 5 lines
Quoted 2 lines

Al, Christian, are either of you going to pick up this fix to send to Linus? If not, any objection if I send this up?

It's been in vfs.fixes for some time already and it'll go out with the first round of post -rc1 fixes this week.

Great, thanks. I didn't see any replies on-list indicating that the patch had been picked up, so I just wanted to make sure someone was

Hm, odd. I did send a b4 ty I'm pretty sure.

author maintainer
#8 lore raw
Quoted 47 lines · Christian Brauner
Quoted 45 lines · Paul Moore
Quoted 44 lines · Christian Brauner
Quoted 41 lines · Paul Moore
Quoted 30 lines · Collin Funk
Quoted 19 lines · Paul Moore
Quoted 19 lines
Quoted 17 lines · <[email protected]> wrote:

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.

Fixes 8b0ba61df5a1 ("fs/xattr.c: fix simple_xattr_list to always include security.* xattrs")
---
 fs/xattr.c | 1 +
 1 file changed, 1 insertion(+)
Quoted 7 lines
Quoted 1 line

Resending this as it appears that Stephen's original posting had a typo in the VFS mailing list. The original post can be found in the SELinux archives:

https://lore.kernel.org/selinux/[email protected]/

Hi, responding to this message since it has the correct lists.

Quoted 7 lines

I just booted into a kernel with this patch applied and confirm that it fixes the Gnulib tests that were failing.

Thanks for the fix.

Al, Christian, are either of you going to pick up this fix to send to Linus? If not, any objection if I send this up?

Quoted 7 lines
Quoted 5 lines
Quoted 2 lines

It's been in vfs.fixes for some time already and it'll go out with the first round of post -rc1 fixes this week.

Great, thanks. I didn't see any replies on-list indicating that the patch had been picked up, so I just wanted to make sure someone was

Hm, odd. I did send a b4 ty I'm pretty sure.

I didn't receive any reply fwiw. But no worries - thanks for applying it!

maintainer
#9 lore raw
In reply to Christian Brauner
Quoted 38 lines · Christian Brauner
Quoted 37 lines · Paul Moore
Quoted 36 lines · Collin Funk
Quoted 19 lines · Paul Moore
Quoted 19 lines
Quoted 17 lines · <[email protected]> wrote:

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.

Fixes 8b0ba61df5a1 ("fs/xattr.c: fix simple_xattr_list to always include security.* xattrs")
---
 fs/xattr.c | 1 +
 1 file changed, 1 insertion(+)
Quoted 7 lines
Quoted 1 line

Resending this as it appears that Stephen's original posting had a typo in the VFS mailing list. The original post can be found in the SELinux archives:

https://lore.kernel.org/selinux/[email protected]/

Hi, responding to this message since it has the correct lists.

I just booted into a kernel with this patch applied and confirm that it fixes the Gnulib tests that were failing.

Quoted 7 lines
Quoted 4 lines
Quoted 1 line

Thanks for the fix.

Al, Christian, are either of you going to pick up this fix to send to Linus? If not, any objection if I send this up?

It's been in vfs.fixes for some time already and it'll go out with the first round of post -rc1 fixes this week.

Checking on the status of this patch as we are at -rc2 and I don't see it in Linus' tree?

Signature · 1 line
paul-moore.com
#10 lore raw
Quoted 41 lines · Paul Moore
Quoted 40 lines · Christian Brauner
Quoted 39 lines · Paul Moore
Quoted 37 lines · Collin Funk
Quoted 19 lines · Paul Moore
Quoted 19 lines
Quoted 17 lines · <[email protected]> wrote:

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.

Fixes 8b0ba61df5a1 ("fs/xattr.c: fix simple_xattr_list to always include security.* xattrs")
---
 fs/xattr.c | 1 +
 1 file changed, 1 insertion(+)
Quoted 7 lines
Quoted 1 line

Resending this as it appears that Stephen's original posting had a typo in the VFS mailing list. The original post can be found in the SELinux archives:

https://lore.kernel.org/selinux/[email protected]/

Hi, responding to this message since it has the correct lists.

I just booted into a kernel with this patch applied and confirm that it fixes the Gnulib tests that were failing.

Thanks for the fix.

Quoted 8 lines
Quoted 5 lines
Quoted 2 lines

Al, Christian, are either of you going to pick up this fix to send to Linus? If not, any objection if I send this up?

It's been in vfs.fixes for some time already and it'll go out with the first round of post -rc1 fixes this week.

Checking on the status of this patch as we are at -rc2 and I don't see it in Linus' tree?

Sent this morning with some other fixes.