linux-nfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/8] NFSv4: Fix a credential refcount leak in nfs41_check_delegation_stateid
@ 2019-08-03 14:58 Trond Myklebust
  2019-08-03 14:58 ` [PATCH 2/8] NFSv4: Fix delegation state recovery Trond Myklebust
  0 siblings, 1 reply; 10+ messages in thread
From: Trond Myklebust @ 2019-08-03 14:58 UTC (permalink / raw)
  To: linux-nfs

It is unsafe to dereference delegation outside the rcu lock, and in
any case, the refcount is guaranteed held if cred is non-zero.

Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
---
 fs/nfs/nfs4proc.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index 39896afc6edf..a6d73609b163 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -2778,8 +2778,7 @@ static void nfs41_check_delegation_stateid(struct nfs4_state *state)
 	if (status == -NFS4ERR_EXPIRED || status == -NFS4ERR_BAD_STATEID)
 		nfs_finish_clear_delegation_stateid(state, &stateid);
 
-	if (delegation->cred)
-		put_cred(cred);
+	put_cred(cred);
 }
 
 /**
-- 
2.21.0


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

end of thread, other threads:[~2019-08-03 17:10 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-03 14:58 [PATCH 1/8] NFSv4: Fix a credential refcount leak in nfs41_check_delegation_stateid Trond Myklebust
2019-08-03 14:58 ` [PATCH 2/8] NFSv4: Fix delegation state recovery Trond Myklebust
2019-08-03 14:58   ` [PATCH 3/8] NFSv4: Print an error in the syslog when state is marked as irrecoverable Trond Myklebust
2019-08-03 14:58     ` [PATCH 4/8] NFSv4: When recovering state fails with EAGAIN, retry the same recovery Trond Myklebust
2019-08-03 14:58       ` [PATCH 5/8] NFSv4: Report the error from nfs4_select_rw_stateid() Trond Myklebust
2019-08-03 14:58         ` [PATCH 6/8] NFSv4.1: Fix open stateid recovery Trond Myklebust
2019-08-03 14:58           ` [PATCH 7/8] NFSv4.1: Only reap expired delegations Trond Myklebust
2019-08-03 14:58             ` [PATCH 8/8] NFSv4: Check the return value of update_open_stateid() Trond Myklebust
2019-08-03 17:09               ` Sasha Levin
2019-08-03 17:09   ` [PATCH 2/8] NFSv4: Fix delegation state recovery Sasha Levin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).