aboutsummaryrefslogtreecommitdiffstats
path: root/net/sunrpc/auth_gss
diff options
context:
space:
mode:
authorJ. Bruce Fields <bfields@citi.umich.edu>2006-06-30 04:56:16 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2006-06-30 14:25:40 -0400
commit1df0cada03644e37ae6fefd7c0267d9a531991e2 (patch)
tree5b57b7749bba84ff31e4966e18d237e1dc77c2f2 /net/sunrpc/auth_gss
parent270d56e536dcd37cc819a6adb51d918185411048 (diff)
[PATCH] knfsd: svcrpc: gss: simplify rsc_parse()
Adopt a simpler convention for gss_mech_put(), to simplify rsc_parse(). Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu> Signed-off-by: Neil Brown <neilb@suse.de> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'net/sunrpc/auth_gss')
-rw-r--r--net/sunrpc/auth_gss/gss_mech_switch.c6
-rw-r--r--net/sunrpc/auth_gss/svcauth_gss.c12
2 files changed, 7 insertions, 11 deletions
diff --git a/net/sunrpc/auth_gss/gss_mech_switch.c b/net/sunrpc/auth_gss/gss_mech_switch.c
index f8bac6ccd524..d88468d21c37 100644
--- a/net/sunrpc/auth_gss/gss_mech_switch.c
+++ b/net/sunrpc/auth_gss/gss_mech_switch.c
@@ -224,7 +224,8 @@ EXPORT_SYMBOL(gss_service_to_auth_domain_name);
224void 224void
225gss_mech_put(struct gss_api_mech * gm) 225gss_mech_put(struct gss_api_mech * gm)
226{ 226{
227 module_put(gm->gm_owner); 227 if (gm)
228 module_put(gm->gm_owner);
228} 229}
229 230
230EXPORT_SYMBOL(gss_mech_put); 231EXPORT_SYMBOL(gss_mech_put);
@@ -307,8 +308,7 @@ gss_delete_sec_context(struct gss_ctx **context_handle)
307 (*context_handle)->mech_type->gm_ops 308 (*context_handle)->mech_type->gm_ops
308 ->gss_delete_sec_context((*context_handle) 309 ->gss_delete_sec_context((*context_handle)
309 ->internal_ctx_id); 310 ->internal_ctx_id);
310 if ((*context_handle)->mech_type) 311 gss_mech_put((*context_handle)->mech_type);
311 gss_mech_put((*context_handle)->mech_type);
312 kfree(*context_handle); 312 kfree(*context_handle);
313 *context_handle=NULL; 313 *context_handle=NULL;
314 return GSS_S_COMPLETE; 314 return GSS_S_COMPLETE;
diff --git a/net/sunrpc/auth_gss/svcauth_gss.c b/net/sunrpc/auth_gss/svcauth_gss.c
index d51e316c5821..71f57a5d800d 100644
--- a/net/sunrpc/auth_gss/svcauth_gss.c
+++ b/net/sunrpc/auth_gss/svcauth_gss.c
@@ -425,6 +425,7 @@ static int rsc_parse(struct cache_detail *cd,
425 struct rsc rsci, *rscp = NULL; 425 struct rsc rsci, *rscp = NULL;
426 time_t expiry; 426 time_t expiry;
427 int status = -EINVAL; 427 int status = -EINVAL;
428 struct gss_api_mech *gm = NULL;
428 429
429 memset(&rsci, 0, sizeof(rsci)); 430 memset(&rsci, 0, sizeof(rsci));
430 /* context handle */ 431 /* context handle */
@@ -453,7 +454,6 @@ static int rsc_parse(struct cache_detail *cd,
453 set_bit(CACHE_NEGATIVE, &rsci.h.flags); 454 set_bit(CACHE_NEGATIVE, &rsci.h.flags);
454 else { 455 else {
455 int N, i; 456 int N, i;
456 struct gss_api_mech *gm;
457 457
458 /* gid */ 458 /* gid */
459 if (get_int(&mesg, &rsci.cred.cr_gid)) 459 if (get_int(&mesg, &rsci.cred.cr_gid))
@@ -488,21 +488,17 @@ static int rsc_parse(struct cache_detail *cd,
488 status = -EINVAL; 488 status = -EINVAL;
489 /* mech-specific data: */ 489 /* mech-specific data: */
490 len = qword_get(&mesg, buf, mlen); 490 len = qword_get(&mesg, buf, mlen);
491 if (len < 0) { 491 if (len < 0)
492 gss_mech_put(gm);
493 goto out; 492 goto out;
494 }
495 status = gss_import_sec_context(buf, len, gm, &rsci.mechctx); 493 status = gss_import_sec_context(buf, len, gm, &rsci.mechctx);
496 if (status) { 494 if (status)
497 gss_mech_put(gm);
498 goto out; 495 goto out;
499 }
500 gss_mech_put(gm);
501 } 496 }
502 rsci.h.expiry_time = expiry; 497 rsci.h.expiry_time = expiry;
503 rscp = rsc_update(&rsci, rscp); 498 rscp = rsc_update(&rsci, rscp);
504 status = 0; 499 status = 0;
505out: 500out:
501 gss_mech_put(gm);
506 rsc_free(&rsci); 502 rsc_free(&rsci);
507 if (rscp) 503 if (rscp)
508 cache_put(&rscp->h, &rsc_cache); 504 cache_put(&rscp->h, &rsc_cache);