Commit 9edbd953 authored by Weston Andros Adamson's avatar Weston Andros Adamson Committed by Trond Myklebust

NFSv4: fix server_scope memory leak

server_scope would never be freed if nfs4_check_cl_exchange_flags() returned
non-zero
Signed-off-by: default avatarWeston Andros Adamson <dros@netapp.com>
Cc: stable@vger.kernel.org
Signed-off-by: default avatarTrond Myklebust <Trond.Myklebust@netapp.com>
parent db8ac8ba
...@@ -4945,8 +4945,10 @@ int nfs4_proc_exchange_id(struct nfs_client *clp, struct rpc_cred *cred) ...@@ -4945,8 +4945,10 @@ int nfs4_proc_exchange_id(struct nfs_client *clp, struct rpc_cred *cred)
clp->cl_rpcclient->cl_auth->au_flavor); clp->cl_rpcclient->cl_auth->au_flavor);
res.server_scope = kzalloc(sizeof(struct server_scope), GFP_KERNEL); res.server_scope = kzalloc(sizeof(struct server_scope), GFP_KERNEL);
if (unlikely(!res.server_scope)) if (unlikely(!res.server_scope)) {
return -ENOMEM; status = -ENOMEM;
goto out;
}
status = rpc_call_sync(clp->cl_rpcclient, &msg, RPC_TASK_TIMEOUT); status = rpc_call_sync(clp->cl_rpcclient, &msg, RPC_TASK_TIMEOUT);
if (!status) if (!status)
...@@ -4963,12 +4965,13 @@ int nfs4_proc_exchange_id(struct nfs_client *clp, struct rpc_cred *cred) ...@@ -4963,12 +4965,13 @@ int nfs4_proc_exchange_id(struct nfs_client *clp, struct rpc_cred *cred)
clp->server_scope = NULL; clp->server_scope = NULL;
} }
if (!clp->server_scope) if (!clp->server_scope) {
clp->server_scope = res.server_scope; clp->server_scope = res.server_scope;
else goto out;
kfree(res.server_scope); }
} }
kfree(res.server_scope);
out:
dprintk("<-- %s status= %d\n", __func__, status); dprintk("<-- %s status= %d\n", __func__, status);
return status; return status;
} }
......
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