+ auth_gss-unregister-gss_domain-when-unloading-module.patch added to -mm tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The patch titled
     auth_gss: unregister gss_domain when unloading module
has been added to the -mm tree.  Its filename is
     auth_gss-unregister-gss_domain-when-unloading-module.patch

See http://www.zip.com.au/~akpm/linux/patches/stuff/added-to-mm.txt to find
out what to do about this

------------------------------------------------------
Subject: auth_gss: unregister gss_domain when unloading module
From: Akinobu Mita <akinobu.mita@xxxxxxxxx>

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@xxxxxxxxxxxxxx>
Cc: J. Bruce Fields <bfields@xxxxxxxxxxxxxx>
Cc: Trond Myklebust <Trond.Myklebust@xxxxxxxxxx>
Signed-off-by: Akinobu Mita <akinobu.mita@xxxxxxxxx>
Signed-off-by: Andrew Morton <akpm@xxxxxxxx>
---

 include/linux/sunrpc/svcauth_gss.h    |    1 +
 net/sunrpc/auth_gss/gss_mech_switch.c |    8 +++++++-
 net/sunrpc/auth_gss/svcauth_gss.c     |   21 ++++++++++++++++++---
 3 files changed, 26 insertions(+), 4 deletions(-)

diff -puN include/linux/sunrpc/svcauth_gss.h~auth_gss-unregister-gss_domain-when-unloading-module include/linux/sunrpc/svcauth_gss.h
--- a/include/linux/sunrpc/svcauth_gss.h~auth_gss-unregister-gss_domain-when-unloading-module
+++ a/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 */
diff -puN net/sunrpc/auth_gss/gss_mech_switch.c~auth_gss-unregister-gss_domain-when-unloading-module net/sunrpc/auth_gss/gss_mech_switch.c
--- a/net/sunrpc/auth_gss/gss_mech_switch.c~auth_gss-unregister-gss_domain-when-unloading-module
+++ a/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:
diff -puN net/sunrpc/auth_gss/svcauth_gss.c~auth_gss-unregister-gss_domain-when-unloading-module net/sunrpc/auth_gss/svcauth_gss.c
--- a/net/sunrpc/auth_gss/svcauth_gss.c~auth_gss-unregister-gss_domain-when-unloading-module
+++ a/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)
 {
_

Patches currently in -mm which might be from akinobu.mita@xxxxxxxxx are

isdn-gigaset-avoid-cs-dev-null-pointer-dereference.patch
acpi-fix-single-linked-list-manipulation.patch
debugfs-check-return-value-correctly.patch
lightning-return-proper-return-code.patch
git-mtd.patch
n2-fix-confusing-error-code.patch
tokenring-fix-module_init-error-handling.patch
gss_spkm3-fix-error-handling-in-module-init.patch
sunrpc-add-missing-spin_unlock.patch
auth_gss-unregister-gss_domain-when-unloading-module.patch
git-pcmcia.patch
pci-fix-__pci_register_driver-error-handling.patch
acpiphp-fix-missing-acpiphp_glue_exit.patch
git-watchdog.patch
edac_mc-fix-error-handling.patch
paride-return-proper-error-code.patch
bit-revese-library.patch
crc32-replace-bitreverse-by-bitrev32.patch
video-use-bitrev8.patch
net-use-bitrev8.patch
isdn-hisax-use-bitrev8.patch
atm-ambassador-use-bitrev8.patch
isdn-gigaset-use-bitrev8.patch
isdn-fix-missing-unregister_capi_driver.patch

-
To unsubscribe from this list: send the line "unsubscribe mm-commits" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Kernel Newbies FAQ]     [Kernel Archive]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Photo]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]

  Powered by Linux