]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
nfsd4: disallow ALLOCATE with special stateids
authorJ. Bruce Fields <bfields@redhat.com>
Fri, 3 Apr 2015 20:24:27 +0000 (16:24 -0400)
committerJ. Bruce Fields <bfields@redhat.com>
Tue, 21 Apr 2015 19:44:06 +0000 (15:44 -0400)
vfs_fallocate will hit a NULL dereference if the client tries an
ALLOCATE or DEALLOCATE with a special stateid.  Fix that.  (We also
depend on the open to have broken any conflicting leases or delegations
for us.)

(If it turns out we need to allow special stateid's then we could do a
temporary open here in the special-stateid case, as we do for read and
write.  For now I'm assuming it's not necessary.)

Fixes: 95d871f03cae "nfsd: Add ALLOCATE support"
Cc: stable@vger.kernel.org
Cc: Anna Schumaker <Anna.Schumaker@Netapp.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
fs/nfsd/nfs4proc.c

index b401da386604a999398b39d0754a7cfa4e4bb726..d0848fc6529edba95baf30d120be4d80a19cb9d9 100644 (file)
@@ -1030,6 +1030,8 @@ nfsd4_fallocate(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
                dprintk("NFSD: nfsd4_fallocate: couldn't process stateid!\n");
                return status;
        }
+       if (!file)
+               return nfserr_bad_stateid;
 
        status = nfsd4_vfs_fallocate(rqstp, &cstate->current_fh, file,
                                     fallocate->falloc_offset,