]> git.karo-electronics.de Git - karo-tx-linux.git/blobdiff - net/sunrpc/auth.c
Merge tag 'samsung-fixes-4.7' of git://git.kernel.org/pub/scm/linux/kernel/git/krzk...
[karo-tx-linux.git] / net / sunrpc / auth.c
index 02f53674dc39d6973d374f18b43bd0b1b93952c7..040ff627c18a52f463e6a27e06b3794f4b0b5b10 100644 (file)
@@ -543,7 +543,7 @@ rpcauth_cache_enforce_limit(void)
  */
 struct rpc_cred *
 rpcauth_lookup_credcache(struct rpc_auth *auth, struct auth_cred * acred,
-               int flags)
+               int flags, gfp_t gfp)
 {
        LIST_HEAD(free);
        struct rpc_cred_cache *cache = auth->au_credcache;
@@ -580,7 +580,7 @@ rpcauth_lookup_credcache(struct rpc_auth *auth, struct auth_cred * acred,
        if (flags & RPCAUTH_LOOKUP_RCU)
                return ERR_PTR(-ECHILD);
 
-       new = auth->au_ops->crcreate(auth, acred, flags);
+       new = auth->au_ops->crcreate(auth, acred, flags, gfp);
        if (IS_ERR(new)) {
                cred = new;
                goto out;
@@ -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))