Linux NFS development
 help / color / mirror / Atom feed
* [PATCH] nfsd: Detect unhashed stids in nfsd4_verify_open_stid()
@ 2018-01-12 22:42 Trond Myklebust
  2018-01-13  2:15 ` Chuck Lever
  0 siblings, 1 reply; 4+ messages in thread
From: Trond Myklebust @ 2018-01-12 22:42 UTC (permalink / raw)
  To: Bruce Fields, Chuck Lever; +Cc: linux-nfs

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 <trond.myklebust@primarydata.com>
---
 fs/nfsd/nfs4state.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
index 8d53d29161f5..b5bda115f6a9 100644
--- a/fs/nfsd/nfs4state.c
+++ b/fs/nfsd/nfs4state.c
@@ -3591,6 +3591,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;
-- 
2.14.3


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-01-18  1:58 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-01-12 22:42 [PATCH] nfsd: Detect unhashed stids in nfsd4_verify_open_stid() Trond Myklebust
2018-01-13  2:15 ` Chuck Lever
2018-01-17 21:30   ` J. Bruce Fields
2018-01-18  1:58     ` J. Bruce Fields

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox