Commit 4f176417 authored by Trond Myklebust's avatar Trond Myklebust Committed by J. Bruce Fields

nfsd: Detect unhashed stids in nfsd4_verify_open_stid()

The state of the stid is guaranteed by 2 locks:
- The nfs4_client 'cl_lock' spinlock
- The nfs4_ol_stateid 'st_mutex' mutex

so it is quite possible for the stid to be unhashed after lookup,
but before calling nfsd4_lock_ol_stateid(). So we do need to check
for a zero value for 'sc_type' in nfsd4_verify_open_stid().
Signed-off-by: default avatarTrond Myklebust <trond.myklebust@primarydata.com>
Tested-by: default avatarChecuk Lever <chuck.lever@oracle.com>
Cc: stable@vger.kernel.org
Fixes: 659aefb6 "nfsd: Ensure we don't recognise lock stateids..."
Signed-off-by: default avatarJ. Bruce Fields <bfields@redhat.com>
parent d0945caa
...@@ -3590,6 +3590,7 @@ nfsd4_verify_open_stid(struct nfs4_stid *s) ...@@ -3590,6 +3590,7 @@ nfsd4_verify_open_stid(struct nfs4_stid *s)
switch (s->sc_type) { switch (s->sc_type) {
default: default:
break; break;
case 0:
case NFS4_CLOSED_STID: case NFS4_CLOSED_STID:
case NFS4_CLOSED_DELEG_STID: case NFS4_CLOSED_DELEG_STID:
ret = nfserr_bad_stateid; ret = nfserr_bad_stateid;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment