]> git.proxmox.com Git - mirror_ubuntu-zesty-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)
committerThadeu Lima de Souza Cascardo <cascardo@canonical.com>
Tue, 27 Jun 2017 13:16:24 +0000 (10:16 -0300)
BugLink: http://bugs.launchpad.net/bugs/1698799
commit b26b78cb726007533d81fdf90a62e915002ef5c8 upstream.

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: 75976de6556f ("NFSD: Return word2 bitmask if setting security..,")
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@canonical.com>
fs/nfsd/nfs4xdr.c

index c3e1cb481fe0e990e126cf93df8192f2c2babf97..3f68a25f216917f82d6ff665c03e300b2494f80f 100644 (file)
@@ -2753,9 +2753,16 @@ 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];
+
+               supp[0] = nfsd_suppattrs0(minorversion);
+               supp[1] = nfsd_suppattrs1(minorversion);
+               supp[2] = nfsd_suppattrs2(minorversion);
+               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;
        }