summaryrefslogtreecommitdiffstats
path: root/fs/nfs
diff options
context:
space:
mode:
authorTrond Myklebust <trond.myklebust@hammerspace.com>2019-07-19 13:48:44 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2019-08-29 08:30:12 +0200
commit8c0391db53efffb30913c06367f1b3793fc3ba18 (patch)
tree0e0f6f4664363bb2b6be2c0fa0c320604fb62316 /fs/nfs
parent1cfb3722bb57d257148c77f87468c19eeaa852a2 (diff)
downloadlinux-stable-8c0391db53efffb30913c06367f1b3793fc3ba18.tar.gz
linux-stable-8c0391db53efffb30913c06367f1b3793fc3ba18.tar.bz2
linux-stable-8c0391db53efffb30913c06367f1b3793fc3ba18.zip
NFSv4: Fix a credential refcount leak in nfs41_check_delegation_stateid
[ Upstream commit 8c39a39e28b86a4021d9be314ce01019bafa5fdc ] 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> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'fs/nfs')
-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 63edda145d1b..420f2350c278 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -2752,8 +2752,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);
}
/**