public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] auth_gss: unregister gss_domain when unloading module
@ 2006-10-28 18:55 Akinobu Mita
  2006-10-29 13:35 ` Akinobu Mita
  2006-10-29 19:46 ` [PATCH] auth_gss: unregister gss_domain when unloading module Trond Myklebust
  0 siblings, 2 replies; 17+ messages in thread
From: Akinobu Mita @ 2006-10-28 18:55 UTC (permalink / raw)
  To: linux-kernel; +Cc: Andy Adamson, J. Bruce Fields, Trond Myklebust

Reloading rpcsec_gss_krb5 or rpcsec_gss_spkm3 hit duplicate
registration in svcauth_gss_register_pseudoflavor().
(If DEBUG_PAGEALLOC is enabled, oops will happen at
auth_domain_put() --> hlist_del() with uninitialized hlist_node)

svcauth_gss_register_pseudoflavor(u32 pseudoflavor, char * name)
{
	...

        test = auth_domain_lookup(name, &new->h);
        if (test != &new->h) { /* XXX Duplicate registration? */
                auth_domain_put(&new->h);
                /* dangling ref-count... */
	...
}

This patch unregisters gss_domain and free it when unloading
modules (rpcsec_gss_krb5 or rpcsec_gss_spkm3 module call
gss_mech_unregister())

Cc: Andy Adamson <andros@citi.umich.edu>
Cc: "J. Bruce Fields" <bfields@citi.umich.edu>
Cc: Trond Myklebust <Trond.Myklebust@netapp.com>
Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>

 net/sunrpc/auth_gss/gss_mech_switch.c |    4 ++++
 net/sunrpc/auth_gss/svcauth_gss.c     |    6 +++---
 2 files changed, 7 insertions(+), 3 deletions(-)

Index: work-fault-inject/net/sunrpc/auth_gss/gss_mech_switch.c
===================================================================
--- work-fault-inject.orig/net/sunrpc/auth_gss/gss_mech_switch.c
+++ work-fault-inject/net/sunrpc/auth_gss/gss_mech_switch.c
@@ -59,7 +59,11 @@ gss_mech_free(struct gss_api_mech *gm)
 	int i;
 
 	for (i = 0; i < gm->gm_pf_num; i++) {
+		struct auth_domain *dom;
+
 		pf = &gm->gm_pfs[i];
+		dom = auth_domain_find(pf->auth_domain_name);
+		auth_domain_put(dom);
 		kfree(pf->auth_domain_name);
 		pf->auth_domain_name = NULL;
 	}
Index: work-fault-inject/net/sunrpc/auth_gss/svcauth_gss.c
===================================================================
--- work-fault-inject.orig/net/sunrpc/auth_gss/svcauth_gss.c
+++ work-fault-inject/net/sunrpc/auth_gss/svcauth_gss.c
@@ -765,9 +765,9 @@ svcauth_gss_register_pseudoflavor(u32 ps
 
 	test = auth_domain_lookup(name, &new->h);
 	if (test != &new->h) { /* XXX Duplicate registration? */
-		auth_domain_put(&new->h);
-		/* dangling ref-count... */
-		goto out;
+		WARN_ON(1);
+		kfree(new->h.name);
+		goto out_free_dom;
 	}
 	return 0;
 

^ permalink raw reply	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2006-11-06 12:36 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-10-28 18:55 [PATCH] auth_gss: unregister gss_domain when unloading module Akinobu Mita
2006-10-29 13:35 ` Akinobu Mita
2006-10-29 13:37   ` [PATCH 1/2] sunrpc: add missing spin_unlock Akinobu Mita
2006-10-29 13:38     ` [PATCH 2/2] auth_gss: unregister gss_domain when unloading module Akinobu Mita
2006-10-29 20:15       ` Trond Myklebust
2006-10-30 14:54         ` Akinobu Mita
2006-10-30 15:17           ` Trond Myklebust
2006-10-31  3:15             ` Akinobu Mita
2006-10-31  4:13               ` Neil Brown
2006-10-29 20:21     ` [PATCH 1/2] sunrpc: add missing spin_unlock Trond Myklebust
2006-10-30  5:43       ` Neil Brown
2006-10-30 14:57         ` [PATCH -mm] sunrpc/auth_gss: auth_domain refcount fix Akinobu Mita
2006-11-05 16:35     ` [PATCH 1/2] sunrpc: add missing spin_unlock Peter Zijlstra
2006-11-05 19:45       ` Andrew Morton
2006-11-05 19:58         ` Peter Zijlstra
2006-11-05 22:04         ` Elimar Riesebieter
2006-10-29 19:46 ` [PATCH] auth_gss: unregister gss_domain when unloading module Trond Myklebust

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox