nfsd4: buffer-length check for SUPPATTR_EXCLCREAT
authorJ. Bruce Fields <bfields@redhat.com>
Tue, 28 Jan 2014 21:05:15 +0000 (16:05 -0500)
committerJ. Bruce Fields <bfields@redhat.com>
Thu, 27 Mar 2014 20:30:42 +0000 (16:30 -0400)
This was an omission from 8c18f2052e756e7d5dea712fc6e7ed70c00e8a39
"nfsd41: SUPPATTR_EXCLCREAT attribute".

Cc: Benny Halevy <bhalevy@primarydata.com>
Cc: stable@vger.kernel.org
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
fs/nfsd/nfs4xdr.c

index 63f2395..668bfe1 100644 (file)
@@ -2483,6 +2483,8 @@ out_acl:
                        goto out;
        }
        if (bmval2 & FATTR4_WORD2_SUPPATTR_EXCLCREAT) {
+               if ((buflen -= 16) < 0)
+                       goto out_resource;
                WRITE32(3);
                WRITE32(NFSD_SUPPATTR_EXCLCREAT_WORD0);
                WRITE32(NFSD_SUPPATTR_EXCLCREAT_WORD1);