Skip to content

Commit 243fea1

Browse files
Olga KornievskaiaAnna Schumaker
authored andcommitted
NFSv4.2: fix listxattr to return selinux security label
Currently, when NFS is queried for all the labels present on the file via a command example "getfattr -d -m . /mnt/testfile", it does not return the security label. Yet when asked specifically for the label (getfattr -n security.selinux) it will be returned. Include the security label when all attributes are queried. Signed-off-by: Olga Kornievskaia <[email protected]> Signed-off-by: Anna Schumaker <[email protected]>
1 parent aba41e9 commit 243fea1

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

fs/nfs/nfs4proc.c

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10858,7 +10858,7 @@ const struct nfs4_minor_version_ops *nfs_v4_minor_ops[] = {
1085810858

1085910859
static ssize_t nfs4_listxattr(struct dentry *dentry, char *list, size_t size)
1086010860
{
10861-
ssize_t error, error2, error3;
10861+
ssize_t error, error2, error3, error4;
1086210862
size_t left = size;
1086310863

1086410864
error = generic_listxattr(dentry, list, left);
@@ -10881,8 +10881,16 @@ static ssize_t nfs4_listxattr(struct dentry *dentry, char *list, size_t size)
1088110881
error3 = nfs4_listxattr_nfs4_user(d_inode(dentry), list, left);
1088210882
if (error3 < 0)
1088310883
return error3;
10884+
if (list) {
10885+
list += error3;
10886+
left -= error3;
10887+
}
10888+
10889+
error4 = security_inode_listsecurity(d_inode(dentry), list, left);
10890+
if (error4 < 0)
10891+
return error4;
1088410892

10885-
error += error2 + error3;
10893+
error += error2 + error3 + error4;
1088610894
if (size && error > size)
1088710895
return -ERANGE;
1088810896
return error;

0 commit comments

Comments
 (0)