Commit 5aebf314 authored by Trond Myklebust's avatar Trond Myklebust Committed by Linus Torvalds

[PATCH] RPCSEC_GSS: Fix a refcount leak

RPC: Fix a module refcount leak in RPCSEC_GSS
Signed-off-by: default avatarTrond Myklebust <Trond.Myklebust@netapp.com>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent e69a5406
...@@ -593,9 +593,11 @@ gss_create(struct rpc_clnt *clnt, rpc_authflavor_t flavor) ...@@ -593,9 +593,11 @@ gss_create(struct rpc_clnt *clnt, rpc_authflavor_t flavor)
gss_auth->mech->gm_name); gss_auth->mech->gm_name);
gss_auth->dentry = rpc_mkpipe(gss_auth->path, clnt, &gss_upcall_ops, RPC_PIPE_WAIT_FOR_OPEN); gss_auth->dentry = rpc_mkpipe(gss_auth->path, clnt, &gss_upcall_ops, RPC_PIPE_WAIT_FOR_OPEN);
if (IS_ERR(gss_auth->dentry)) if (IS_ERR(gss_auth->dentry))
goto err_free; goto err_put_mech;
return auth; return auth;
err_put_mech:
gss_mech_put(gss_auth->mech);
err_free: err_free:
kfree(gss_auth); kfree(gss_auth);
out_dec: out_dec:
...@@ -612,6 +614,7 @@ gss_destroy(struct rpc_auth *auth) ...@@ -612,6 +614,7 @@ gss_destroy(struct rpc_auth *auth)
gss_auth = container_of(auth, struct gss_auth, rpc_auth); gss_auth = container_of(auth, struct gss_auth, rpc_auth);
rpc_unlink(gss_auth->path); rpc_unlink(gss_auth->path);
gss_mech_put(gss_auth->mech);
rpcauth_free_credcache(auth); rpcauth_free_credcache(auth);
} }
......
...@@ -150,9 +150,8 @@ gss_mech_get_by_name(char *name) ...@@ -150,9 +150,8 @@ gss_mech_get_by_name(char *name)
spin_lock(&registered_mechs_lock); spin_lock(&registered_mechs_lock);
list_for_each_entry(pos, &registered_mechs, gm_list) { list_for_each_entry(pos, &registered_mechs, gm_list) {
if (0 == strcmp(name, pos->gm_name)) { if (0 == strcmp(name, pos->gm_name)) {
if (!try_module_get(pos->gm_owner)) if (try_module_get(pos->gm_owner))
continue; gm = pos;
gm = pos;
break; break;
} }
} }
...@@ -182,13 +181,12 @@ gss_mech_get_by_pseudoflavor(u32 pseudoflavor) ...@@ -182,13 +181,12 @@ gss_mech_get_by_pseudoflavor(u32 pseudoflavor)
spin_lock(&registered_mechs_lock); spin_lock(&registered_mechs_lock);
list_for_each_entry(pos, &registered_mechs, gm_list) { list_for_each_entry(pos, &registered_mechs, gm_list) {
if (!try_module_get(pos->gm_owner))
continue;
if (!mech_supports_pseudoflavor(pos, pseudoflavor)) { if (!mech_supports_pseudoflavor(pos, pseudoflavor)) {
module_put(pos->gm_owner); module_put(pos->gm_owner);
continue; continue;
} }
gm = pos; if (try_module_get(pos->gm_owner))
gm = pos;
break; break;
} }
spin_unlock(&registered_mechs_lock); spin_unlock(&registered_mechs_lock);
......
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