nfsd4: disallow SEEK with special stateids
authorJ. Bruce Fields <bfields@redhat.com>
Tue, 21 Apr 2015 19:25:39 +0000 (15:25 -0400)
committerJ. Bruce Fields <bfields@redhat.com>
Tue, 21 Apr 2015 20:16:01 +0000 (16:16 -0400)
If the client uses a special stateid then we'll pass a NULL file to
vfs_llseek.

Fixes: 24bab491220f " NFSD: Implement SEEK"
Cc: Anna Schumaker <Anna.Schumaker@Netapp.com>
Cc: stable@vger.kernel.org
Reported-by: Christoph Hellwig <hch@infradead.org>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
fs/nfsd/nfs4proc.c

index d0848fc..4a8314f 100644 (file)
@@ -1071,6 +1071,8 @@ nfsd4_seek(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
                dprintk("NFSD: nfsd4_seek: couldn't process stateid!\n");
                return status;
        }
+       if (!file)
+               return nfserr_bad_stateid;
 
        switch (seek->seek_whence) {
        case NFS4_CONTENT_DATA: