Re: [PATCH] NFSv4.2: fix nfs4_listxattr NULL pointer dereference

Achilles Gaikwad <[email protected]>
Newsgroups gmane.linux.nfs
Message-ID <[email protected]>
On Mon, Jul 6, 2026 at 5:55 PM Paul Moore <[email protected]> wrote:
>[...]

> I wonder if it would be better associate the handling code with the
> security_inode_listsecurity() call a bit more closely?  Thinking about
> it quickly, would something like what's below work?
>
>   left2 = left;
>   error2 = security_inode_listsecurity(..., &list, &left2);
>   if (error2 < 0)
>     return error2;
>   error2 = left - left2;
>   if (list)
>     left -= error2;

Yes, that works and is better than what I was proposing.
strace on my nfs mount:

    listxattr("/mnt/abc.txt", NULL, 0) = 26 <-- v1 patch, actual is 42
    listxattr("/mnt/abc.txt", NULL, 0) = 42 <-- with your changes

Tested your suggestion on v4.2 w/ an NFSv4 ACL, an SELinux label and a
user xattr present; both the size query and the exact-size read now
return 42.

Will send a v2 soon, thanks!

-Achilles
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.