Module Name:    src
Committed By:   jnemeth
Date:           Mon Nov 28 03:13:32 UTC 2011

Modified Files:
        src/sys/kern: kern_module.c

Log Message:
Move "unloaded module" debug message higher as it appears that name
sometimes points to memory that gets freed causing the system to crash.


To generate a diff of this commit:
cvs rdiff -u -r1.84 -r1.85 src/sys/kern/kern_module.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/kern/kern_module.c
diff -u src/sys/kern/kern_module.c:1.84 src/sys/kern/kern_module.c:1.85
--- src/sys/kern/kern_module.c:1.84	Sun Nov  6 12:40:04 2011
+++ src/sys/kern/kern_module.c	Mon Nov 28 03:13:31 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_module.c,v 1.84 2011/11/06 12:40:04 tron Exp $	*/
+/*	$NetBSD: kern_module.c,v 1.85 2011/11/28 03:13:31 jnemeth Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_module.c,v 1.84 2011/11/06 12:40:04 tron Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_module.c,v 1.85 2011/11/28 03:13:31 jnemeth Exp $");
 
 #define _MODULE_INTERNAL
 
@@ -1121,6 +1121,7 @@ module_do_unload(const char *name, bool 
 	u_int i;
 
 	KASSERT(kernconfig_is_held());
+	KASSERT(name != NULL);
 
 	mod = module_lookup(name);
 	if (mod == NULL) {
@@ -1156,6 +1157,7 @@ module_do_unload(const char *name, bool 
 	for (i = 0; i < mod->mod_nrequired; i++) {
 		mod->mod_required[i]->mod_refcnt--;
 	}
+	module_print("unloaded module `%s'", name);
 	if (mod->mod_kobj != NULL) {
 		kobj_unload(mod->mod_kobj);
 	}
@@ -1170,7 +1172,6 @@ module_do_unload(const char *name, bool 
 	}
 	module_gen++;
 
-	module_print("unloaded module `%s'", name);
 	return 0;
 }
 

Reply via email to