summaryrefslogtreecommitdiffstats
path: root/net/sunrpc
diff options
context:
space:
mode:
authorTrond Myklebust <trond.myklebust@primarydata.com>2016-05-16 17:42:42 -0400
committerAnna Schumaker <Anna.Schumaker@Netapp.com>2016-05-17 15:48:06 -0400
commit9a8f6b5ea275ff01fc8ef3b8630a3d4ed6b0a362 (patch)
tree5016f7b85eb31806fca6e96e473ce60b3b631b58 /net/sunrpc
parentf538d0ba5be39c52addff01c7ec31f0b90e57dfc (diff)
downloadblackbird-op-linux-9a8f6b5ea275ff01fc8ef3b8630a3d4ed6b0a362.tar.gz
blackbird-op-linux-9a8f6b5ea275ff01fc8ef3b8630a3d4ed6b0a362.zip
SUNRPC: Ensure get_rpccred() and put_rpccred() can take NULL arguments
Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com> Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
Diffstat (limited to 'net/sunrpc')
-rw-r--r--net/sunrpc/auth.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/net/sunrpc/auth.c b/net/sunrpc/auth.c
index e0bb30fd2ed3..040ff627c18a 100644
--- a/net/sunrpc/auth.c
+++ b/net/sunrpc/auth.c
@@ -703,8 +703,7 @@ rpcauth_bindcred(struct rpc_task *task, struct rpc_cred *cred, int flags)
new = rpcauth_bind_new_cred(task, lookupflags);
if (IS_ERR(new))
return PTR_ERR(new);
- if (req->rq_cred != NULL)
- put_rpccred(req->rq_cred);
+ put_rpccred(req->rq_cred);
req->rq_cred = new;
return 0;
}
@@ -712,6 +711,8 @@ rpcauth_bindcred(struct rpc_task *task, struct rpc_cred *cred, int flags)
void
put_rpccred(struct rpc_cred *cred)
{
+ if (cred == NULL)
+ return;
/* Fast path for unhashed credentials */
if (test_bit(RPCAUTH_CRED_HASHED, &cred->cr_flags) == 0) {
if (atomic_dec_and_test(&cred->cr_count))
OpenPOWER on IntegriCloud