summaryrefslogtreecommitdiffstats
path: root/fs/nfs
diff options
context:
space:
mode:
authorDave Wysochanski <dwysocha@redhat.com>2017-04-27 10:45:15 -0400
committerTrond Myklebust <trond.myklebust@primarydata.com>2017-05-05 13:01:32 -0400
commit5c737cb29977896eb0f373d3adbcdea73b815808 (patch)
treece7e35e6df011d9739dca0bfef786de0efbcf644 /fs/nfs
parent0048fdd06614a4ea088f9fcad11511956b795698 (diff)
downloadlinux-5c737cb29977896eb0f373d3adbcdea73b815808.tar.bz2
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: Dave Wysochanski <dwysocha@redhat.com> Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
Diffstat (limited to 'fs/nfs')
-rw-r--r--fs/nfs/nfs4proc.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index 62fc8eed53cc..f48dfb7f3691 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -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))
return -EIO;
data = kmalloc(sizeof(*data), GFP_NOFS);
- if (data == NULL)
+ if (data == NULL) {
+ nfs_put_client(clp);
return -ENOMEM;
+ }
data->client = clp;
data->timestamp = jiffies;
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,
return -EIO;
calldata = kzalloc(sizeof(*calldata), GFP_NOFS);
- if (!calldata)
+ if (!calldata) {
+ nfs_put_client(clp);
return -ENOMEM;
+ }
if (!xprt)
nfs4_init_boot_verifier(clp, &verifier);