Commit 5c737cb2 authored by Dave Wysochanski's avatar Dave Wysochanski Committed by Trond Myklebust

Fix nfs_client refcounting if kmalloc fails in nfs4_proc_exchange_id and nfs4_proc_async_renew

If memory allocation fails for the callback data, we need to put the nfs_client
or we end up with an elevated refcount.
Signed-off-by: default avatarDave Wysochanski <dwysocha@redhat.com>
Signed-off-by: default avatarTrond Myklebust <trond.myklebust@primarydata.com>
parent 0048fdd0
...@@ -4807,8 +4807,10 @@ static int nfs4_proc_async_renew(struct nfs_client *clp, struct rpc_cred *cred, ...@@ -4807,8 +4807,10 @@ static int nfs4_proc_async_renew(struct nfs_client *clp, struct rpc_cred *cred,
if (!atomic_inc_not_zero(&clp->cl_count)) if (!atomic_inc_not_zero(&clp->cl_count))
return -EIO; return -EIO;
data = kmalloc(sizeof(*data), GFP_NOFS); data = kmalloc(sizeof(*data), GFP_NOFS);
if (data == NULL) if (data == NULL) {
nfs_put_client(clp);
return -ENOMEM; return -ENOMEM;
}
data->client = clp; data->client = clp;
data->timestamp = jiffies; data->timestamp = jiffies;
return rpc_call_async(clp->cl_rpcclient, &msg, RPC_TASK_TIMEOUT, return rpc_call_async(clp->cl_rpcclient, &msg, RPC_TASK_TIMEOUT,
...@@ -7454,8 +7456,10 @@ static int _nfs4_proc_exchange_id(struct nfs_client *clp, struct rpc_cred *cred, ...@@ -7454,8 +7456,10 @@ static int _nfs4_proc_exchange_id(struct nfs_client *clp, struct rpc_cred *cred,
return -EIO; return -EIO;
calldata = kzalloc(sizeof(*calldata), GFP_NOFS); calldata = kzalloc(sizeof(*calldata), GFP_NOFS);
if (!calldata) if (!calldata) {
nfs_put_client(clp);
return -ENOMEM; return -ENOMEM;
}
if (!xprt) if (!xprt)
nfs4_init_boot_verifier(clp, &verifier); nfs4_init_boot_verifier(clp, &verifier);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment