Commit 07a2bf1d authored by Trond Myklebust's avatar Trond Myklebust

SUNRPC: Fix a memory leak in gss_create()

Fix a memory leak in gss_create() whereby the rpc credcache was not being
freed if the rpc_mkpipe() call failed.
Signed-off-by: default avatarTrond Myklebust <Trond.Myklebust@netapp.com>
parent 5c9cfc82
...@@ -636,10 +636,6 @@ gss_create(struct rpc_clnt *clnt, rpc_authflavor_t flavor) ...@@ -636,10 +636,6 @@ gss_create(struct rpc_clnt *clnt, rpc_authflavor_t flavor)
auth->au_flavor = flavor; auth->au_flavor = flavor;
atomic_set(&auth->au_count, 1); atomic_set(&auth->au_count, 1);
err = rpcauth_init_credcache(auth, GSS_CRED_EXPIRE);
if (err)
goto err_put_mech;
gss_auth->dentry = rpc_mkpipe(clnt->cl_dentry, gss_auth->mech->gm_name, gss_auth->dentry = rpc_mkpipe(clnt->cl_dentry, gss_auth->mech->gm_name,
clnt, &gss_upcall_ops, RPC_PIPE_WAIT_FOR_OPEN); clnt, &gss_upcall_ops, RPC_PIPE_WAIT_FOR_OPEN);
if (IS_ERR(gss_auth->dentry)) { if (IS_ERR(gss_auth->dentry)) {
...@@ -647,7 +643,13 @@ gss_create(struct rpc_clnt *clnt, rpc_authflavor_t flavor) ...@@ -647,7 +643,13 @@ gss_create(struct rpc_clnt *clnt, rpc_authflavor_t flavor)
goto err_put_mech; goto err_put_mech;
} }
err = rpcauth_init_credcache(auth, GSS_CRED_EXPIRE);
if (err)
goto err_unlink_pipe;
return auth; return auth;
err_unlink_pipe:
rpc_unlink(gss_auth->dentry);
err_put_mech: err_put_mech:
gss_mech_put(gss_auth->mech); gss_mech_put(gss_auth->mech);
err_free: err_free:
......
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