diff options
| -rw-r--r-- | net/sunrpc/auth_gss/auth_gss.c | 5 | ||||
| -rw-r--r-- | net/sunrpc/auth_gss/gss_mech_switch.c | 10 |
2 files changed, 8 insertions, 7 deletions
diff --git a/net/sunrpc/auth_gss/auth_gss.c b/net/sunrpc/auth_gss/auth_gss.c index 6ee0bb02affe..62960a5603e8 100644 --- a/net/sunrpc/auth_gss/auth_gss.c +++ b/net/sunrpc/auth_gss/auth_gss.c @@ -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); } diff --git a/net/sunrpc/auth_gss/gss_mech_switch.c b/net/sunrpc/auth_gss/gss_mech_switch.c index 2d02377d1c9d..a0db9f5004f1 100644 --- a/net/sunrpc/auth_gss/gss_mech_switch.c +++ b/net/sunrpc/auth_gss/gss_mech_switch.c @@ -150,9 +150,8 @@ gss_mech_get_by_name(char *name) spin_lock(®istered_mechs_lock); list_for_each_entry(pos, ®istered_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(®istered_mechs_lock); list_for_each_entry(pos, ®istered_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(®istered_mechs_lock); |
