Skip to content

Commit

Permalink
SUNRPC: Fix potential race in put_rpccred()
Browse files Browse the repository at this point in the history
We have to be careful when we try to unhash the credential in
put_rpccred(), because we're not holding the credcache lock, so the call to
rpcauth_unhash_cred() may fail if someone else has looked the cred up, and
obtained a reference to it.

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
  • Loading branch information
Trond Myklebust authored and Trond Myklebust committed Oct 28, 2008
1 parent eac0d18 commit 5f707eb
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion net/sunrpc/auth.c
Original file line number Diff line number Diff line change
Expand Up @@ -455,7 +455,7 @@ put_rpccred(struct rpc_cred *cred)
}
if (test_bit(RPCAUTH_CRED_UPTODATE, &cred->cr_flags) == 0)
rpcauth_unhash_cred(cred);
else if (test_bit(RPCAUTH_CRED_HASHED, &cred->cr_flags) != 0) {
if (test_bit(RPCAUTH_CRED_HASHED, &cred->cr_flags) != 0) {
cred->cr_expire = jiffies;
list_add_tail(&cred->cr_lru, &cred_unused);
number_cred_unused++;
Expand Down

0 comments on commit 5f707eb

Please sign in to comment.