]> git.baikalelectronics.ru Git - kernel.git/commitdiff
nfsd: Fix up the "supattr_exclcreat" attributes
authorTrond Myklebust <trond.myklebust@primarydata.com>
Tue, 9 May 2017 20:24:59 +0000 (16:24 -0400)
committerJ. Bruce Fields <bfields@redhat.com>
Wed, 10 May 2017 18:30:10 +0000 (14:30 -0400)
If an NFSv4 client asks us for the supattr_exclcreat, then we must
not return attributes that are unsupported by this minor version.

Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
Fixes: ed48236d8a9e ("NFSD: Return word2 bitmask if setting security..,")
Cc: stable@vger.kernel.org
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
fs/nfsd/nfs4xdr.c

index 8e9652f37f1fc71af6a82c346ed7534f78732419..26780d53a6f9412ba50cf3b3711b32d53d061723 100644 (file)
@@ -2831,9 +2831,14 @@ out_acl:
        }
 #endif /* CONFIG_NFSD_PNFS */
        if (bmval2 & FATTR4_WORD2_SUPPATTR_EXCLCREAT) {
-               status = nfsd4_encode_bitmap(xdr, NFSD_SUPPATTR_EXCLCREAT_WORD0,
-                                                 NFSD_SUPPATTR_EXCLCREAT_WORD1,
-                                                 NFSD_SUPPATTR_EXCLCREAT_WORD2);
+               u32 supp[3];
+
+               memcpy(supp, nfsd_suppattrs[minorversion], sizeof(supp));
+               supp[0] &= NFSD_SUPPATTR_EXCLCREAT_WORD0;
+               supp[1] &= NFSD_SUPPATTR_EXCLCREAT_WORD1;
+               supp[2] &= NFSD_SUPPATTR_EXCLCREAT_WORD2;
+
+               status = nfsd4_encode_bitmap(xdr, supp[0], supp[1], supp[2]);
                if (status)
                        goto out;
        }