summaryrefslogtreecommitdiff
path: root/fs
diff options
context:
space:
mode:
authorTrond Myklebust <trond.myklebust@hammerspace.com>2019-07-19 13:48:44 -0400
committerTrond Myklebust <trond.myklebust@hammerspace.com>2019-08-04 22:35:40 -0400
commit8c39a39e28b86a4021d9be314ce01019bafa5fdc (patch)
tree08f4e0f19d2289f40134d1ac8d9c8dbc5fbbe09d /fs
parente21a712a9685488f5ce80495b37b9fdbe96c230d (diff)
NFSv4: Fix a credential refcount leak in nfs41_check_delegation_stateid
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>
Diffstat (limited to 'fs')
-rw-r--r--fs/nfs/nfs4proc.c3
1 files changed, 1 insertions, 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);
}
/**