nfsd4: disallow SEEK with special stateids
authorJ. Bruce Fields <bfields@redhat.com>
Tue, 21 Apr 2015 19:25:39 +0000 (15:25 -0400)
committerSasha Levin <sasha.levin@oracle.com>
Sun, 17 May 2015 23:12:26 +0000 (19:12 -0400)
[ Upstream commit 980608fb50aea34993ba956b71cd4602aa42b14b ]

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>
Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
fs/nfsd/nfs4proc.c

index 0beb023..6ed5859 100644 (file)
@@ -1028,6 +1028,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: