NFSv4: Fix a credential refcount leak in nfs41_check_delegation_stateid
authorTrond Myklebust <trond.myklebust@hammerspace.com>
Fri, 19 Jul 2019 17:48:44 +0000 (13:48 -0400)
committerTrond Myklebust <trond.myklebust@hammerspace.com>
Mon, 5 Aug 2019 02:35:40 +0000 (22:35 -0400)
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

index 39896afc6edf548aad9fb21cbcfce8b377074b7d..a6d73609b16367d0d34a9b5962c7921dda44be79 100644 (file)
@@ -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);
 }
 
 /**