diff mbox series

[1/8] NFSv4: Fix a credential refcount leak in nfs41_check_delegation_stateid

Message ID 20190803145826.15504-1-trond.myklebust@hammerspace.com (mailing list archive)
State New, archived
Headers show
Series [1/8] NFSv4: Fix a credential refcount leak in nfs41_check_delegation_stateid | expand

Commit Message

Trond Myklebust Aug. 3, 2019, 2:58 p.m. UTC
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 mbox series

Patch

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);
 }
 
 /**