Source-Changes-HG archive

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

[src/trunk]: src/sys/kern Move "unloaded module" debug message higher as it a...



details:   https://anonhg.NetBSD.org/src/rev/98203b864317
branches:  trunk
changeset: 771670:98203b864317
user:      jnemeth <jnemeth%NetBSD.org@localhost>
date:      Mon Nov 28 03:13:31 2011 +0000

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

diffstat:

 sys/kern/kern_module.c |  7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

diffs (42 lines):

diff -r bf1717148796 -r 98203b864317 sys/kern/kern_module.c
--- a/sys/kern/kern_module.c    Mon Nov 28 00:30:17 2011 +0000
+++ b/sys/kern/kern_module.c    Mon Nov 28 03:13:31 2011 +0000
@@ -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 @@
        u_int i;
 
        KASSERT(kernconfig_is_held());
+       KASSERT(name != NULL);
 
        mod = module_lookup(name);
        if (mod == NULL) {
@@ -1156,6 +1157,7 @@
        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_gen++;
 
-       module_print("unloaded module `%s'", name);
        return 0;
 }
 



Home | Main Index | Thread Index | Old Index