From: Trond Myklebust Date: Fri, 19 Jul 2019 17:48:44 +0000 (-0400) Subject: NFSv4: Fix a credential refcount leak in nfs41_check_delegation_stateid X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=8c39a39e28b86a4021d9be314ce01019bafa5fdc;p=linux.git 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 --- diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c index 39896afc6edf5..a6d73609b1636 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); } /**