From: Akinobu Mita <akinobu.mita@gmail.com>
To: linux-kernel@vger.kernel.org,
Andy Adamson <andros@citi.umich.edu>,
"J. Bruce Fields" <bfields@citi.umich.edu>,
Trond Myklebust <Trond.Myklebust@netapp.com>,
Olaf Kirch <okir@monad.swb.de>
Subject: [PATCH 2/2] auth_gss: unregister gss_domain when unloading module
Date: Sun, 29 Oct 2006 22:38:16 +0900 [thread overview]
Message-ID: <20061029133816.GB10295@localhost> (raw)
In-Reply-To: <20061029133700.GA10295@localhost>
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.
- Define svcauth_gss_unregister_pseudoflavor()
(doing the opposite of svcauth_gss_register_pseudoflavor())
- Call svcauth_gss_unregister_pseudoflavor() in gss_mech_free()
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
@@ -60,6 +60,9 @@ gss_mech_free(struct gss_api_mech *gm)
for (i = 0; i < gm->gm_pf_num; i++) {
pf = &gm->gm_pfs[i];
+ if (!pf->auth_domain_name)
+ continue;
+ svcauth_gss_unregister_pseudoflavor(pf->auth_domain_name);
kfree(pf->auth_domain_name);
pf->auth_domain_name = NULL;
}
@@ -93,8 +96,11 @@ gss_mech_svc_setup(struct gss_api_mech *
goto out;
status = svcauth_gss_register_pseudoflavor(pf->pseudoflavor,
pf->auth_domain_name);
- if (status)
+ if (status) {
+ kfree(pf->auth_domain_name);
+ pf->auth_domain_name = NULL;
goto out;
+ }
}
return 0;
out:
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,10 +765,12 @@ 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);
+ stat = -EBUSY;
+ kfree(new->h.name);
+ goto out_free_dom;
}
+ auth_domain_put(&new->h);
return 0;
out_free_dom:
@@ -779,6 +781,19 @@ out:
EXPORT_SYMBOL(svcauth_gss_register_pseudoflavor);
+void svcauth_gss_unregister_pseudoflavor(char *name)
+{
+ struct auth_domain *dom;
+
+ dom = auth_domain_find(name);
+ if (dom) {
+ auth_domain_put(dom);
+ auth_domain_put(dom);
+ }
+}
+
+EXPORT_SYMBOL(svcauth_gss_unregister_pseudoflavor);
+
static inline int
read_u32_from_xdr_buf(struct xdr_buf *buf, int base, u32 *obj)
{
Index: work-fault-inject/include/linux/sunrpc/svcauth_gss.h
===================================================================
--- work-fault-inject.orig/include/linux/sunrpc/svcauth_gss.h
+++ work-fault-inject/include/linux/sunrpc/svcauth_gss.h
@@ -22,6 +22,7 @@
int gss_svc_init(void);
void gss_svc_shutdown(void);
int svcauth_gss_register_pseudoflavor(u32 pseudoflavor, char * name);
+void svcauth_gss_unregister_pseudoflavor(char *name);
#endif /* __KERNEL__ */
#endif /* _LINUX_SUNRPC_SVCAUTH_GSS_H */
next prev parent reply other threads:[~2006-10-29 13:37 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
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 ` Akinobu Mita [this message]
2006-10-29 20:15 ` [PATCH 2/2] auth_gss: unregister gss_domain when unloading module 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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20061029133816.GB10295@localhost \
--to=akinobu.mita@gmail.com \
--cc=Trond.Myklebust@netapp.com \
--cc=andros@citi.umich.edu \
--cc=bfields@citi.umich.edu \
--cc=linux-kernel@vger.kernel.org \
--cc=okir@monad.swb.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.