Skip to content

Commit 9686ba1

Browse files
author
Olga Kornievskaia
committed
NFSv4.2: another fix for listxattr
JIRA: https://issues.redhat.com/browse/RHEL-100709 commit 9acb237 Author: Olga Kornievskaia <okorniev@redhat.com> Date: Tue Jul 22 16:56:41 2025 -0400 NFSv4.2: another fix for listxattr Currently, when the server supports NFS4.1 security labels then security.selinux label in included twice. Instead, only add it when the server doesn't possess security label support. Fixes: 243fea1 ("NFSv4.2: fix listxattr to return selinux security label") Signed-off-by: Olga Kornievskaia <okorniev@redhat.com> Link: https://lore.kernel.org/r/20250722205641.79394-1-okorniev@redhat.com Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com> Signed-off-by: Olga Kornievskaia <okorniev@redhat.com>
1 parent 361c4fe commit 9686ba1

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

fs/nfs/nfs4proc.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10831,7 +10831,7 @@ const struct nfs4_minor_version_ops *nfs_v4_minor_ops[] = {
1083110831

1083210832
static ssize_t nfs4_listxattr(struct dentry *dentry, char *list, size_t size)
1083310833
{
10834-
ssize_t error, error2, error3, error4;
10834+
ssize_t error, error2, error3, error4 = 0;
1083510835
size_t left = size;
1083610836

1083710837
error = generic_listxattr(dentry, list, left);
@@ -10859,9 +10859,11 @@ static ssize_t nfs4_listxattr(struct dentry *dentry, char *list, size_t size)
1085910859
left -= error3;
1086010860
}
1086110861

10862-
error4 = security_inode_listsecurity(d_inode(dentry), list, left);
10863-
if (error4 < 0)
10864-
return error4;
10862+
if (!nfs_server_capable(d_inode(dentry), NFS_CAP_SECURITY_LABEL)) {
10863+
error4 = security_inode_listsecurity(d_inode(dentry), list, left);
10864+
if (error4 < 0)
10865+
return error4;
10866+
}
1086510867

1086610868
error += error2 + error3 + error4;
1086710869
if (size && error > size)

0 commit comments

Comments
 (0)