nfsd: Detect unhashed stids in nfsd4_verify_open_stid()

"Linux Kernel Mailing List" <[email protected]>
Newsgroups gmane.linux.kernel.commits.head
Message-ID <[email protected]>
Web:        https://git.kernel.org/torvalds/c/4f1764172a0aa7395d12b96cae640ca1438c5085
Commit:     4f1764172a0aa7395d12b96cae640ca1438c5085
Parent:     d0945caafcccac9d8f4d78f99e0eac9e60386381
Refname:    refs/heads/master
Author:     Trond Myklebust <[email protected]>
AuthorDate: Fri Jan 12 17:42:30 2018 -0500
Committer:  J. Bruce Fields <[email protected]>
CommitDate: Mon Feb 5 17:13:16 2018 -0500

    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: Trond Myklebust <[email protected]>
    Tested-by: Checuk Lever <[email protected]>
    Cc: [email protected]
    Fixes: 659aefb68eca "nfsd: Ensure we don't recognise lock stateids..."
    Signed-off-by: J. Bruce Fields <[email protected]>
---
 fs/nfsd/nfs4state.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
index b29b5a185a2c..5a75135f5f53 100644
--- a/fs/nfsd/nfs4state.c
+++ b/fs/nfsd/nfs4state.c
@@ -3590,6 +3590,7 @@ nfsd4_verify_open_stid(struct nfs4_stid *s)
 	switch (s->sc_type) {
 	default:
 		break;
+	case 0:
 	case NFS4_CLOSED_STID:
 	case NFS4_CLOSED_DELEG_STID:
 		ret = nfserr_bad_stateid;
--
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.