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)
gss_auth->mech->gm_name);
gss_auth->dentry = rpc_mkpipe(gss_auth->path, clnt, &gss_upcall_ops, RPC_PIPE_WAIT_FOR_OPEN);
if (IS_ERR(gss_auth->dentry))
goto err_free;
goto err_put_mech;
return auth;
err_put_mech:
gss_mech_put(gss_auth->mech);
err_free:
kfree(gss_auth);
out_dec:
......@@ -612,6 +614,7 @@ gss_destroy(struct rpc_auth *auth)
gss_auth = container_of(auth, struct gss_auth, rpc_auth);
rpc_unlink(gss_auth->path);
gss_mech_put(gss_auth->mech);
rpcauth_free_credcache(auth);
}
......
......@@ -150,9 +150,8 @@ gss_mech_get_by_name(char *name)
spin_lock(&registered_mechs_lock);
list_for_each_entry(pos, &registered_mechs, gm_list) {
if (0 == strcmp(name, pos->gm_name)) {
if (!try_module_get(pos->gm_owner))
continue;
gm = pos;
if (try_module_get(pos->gm_owner))
gm = pos;
break;
}
}
......@@ -182,13 +181,12 @@ gss_mech_get_by_pseudoflavor(u32 pseudoflavor)
spin_lock(&registered_mechs_lock);
list_for_each_entry(pos, &registered_mechs, gm_list) {
if (!try_module_get(pos->gm_owner))
continue;
if (!mech_supports_pseudoflavor(pos, pseudoflavor)) {
module_put(pos->gm_owner);
continue;
}
gm = pos;
if (try_module_get(pos->gm_owner))
gm = pos;
break;
}
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