1
0
Fork 0

NFSv4: fix server_scope memory leak

server_scope would never be freed if nfs4_check_cl_exchange_flags() returned
non-zero

Signed-off-by: Weston Andros Adamson <dros@netapp.com>
Cc: stable@vger.kernel.org
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
wifi-calibration
Weston Andros Adamson 2012-02-16 11:17:05 -05:00 committed by Trond Myklebust
parent f86f36a6ae
commit abe9a6d57b
1 changed files with 9 additions and 6 deletions

View File

@ -4883,8 +4883,10 @@ int nfs4_proc_exchange_id(struct nfs_client *clp, struct rpc_cred *cred)
clp->cl_rpcclient->cl_auth->au_flavor);
res.server_scope = kzalloc(sizeof(struct server_scope), GFP_KERNEL);
if (unlikely(!res.server_scope))
return -ENOMEM;
if (unlikely(!res.server_scope)) {
status = -ENOMEM;
goto out;
}
status = rpc_call_sync(clp->cl_rpcclient, &msg, RPC_TASK_TIMEOUT);
if (!status)
@ -4901,12 +4903,13 @@ int nfs4_proc_exchange_id(struct nfs_client *clp, struct rpc_cred *cred)
clp->server_scope = NULL;
}
if (!clp->server_scope)
if (!clp->server_scope) {
clp->server_scope = res.server_scope;
else
kfree(res.server_scope);
goto out;
}
}
kfree(res.server_scope);
out:
dprintk("<-- %s status= %d\n", __func__, status);
return status;
}