Source-Changes-HG archive

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

[src/trunk]: src/sys/kern Don't try to autoload modules before root is mounted.



details:   https://anonhg.NetBSD.org/src/rev/3eb5a0281b9c
branches:  trunk
changeset: 352821:3eb5a0281b9c
user:      christos <christos%NetBSD.org@localhost>
date:      Tue Apr 11 14:31:55 2017 +0000

description:
Don't try to autoload modules before root is mounted.

diffstat:

 sys/kern/kern_module.c |  13 +++++++++++--
 1 files changed, 11 insertions(+), 2 deletions(-)

diffs (41 lines):

diff -r 4a4407465118 -r 3eb5a0281b9c sys/kern/kern_module.c
--- a/sys/kern/kern_module.c    Tue Apr 11 14:30:33 2017 +0000
+++ b/sys/kern/kern_module.c    Tue Apr 11 14:31:55 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: kern_module.c,v 1.120 2017/02/01 01:51:07 maya Exp $   */
+/*     $NetBSD: kern_module.c,v 1.121 2017/04/11 14:31:55 christos 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.120 2017/02/01 01:51:07 maya Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_module.c,v 1.121 2017/04/11 14:31:55 christos Exp $");
 
 #define _MODULE_INTERNAL
 
@@ -54,6 +54,7 @@
 #include <sys/kthread.h>
 #include <sys/sysctl.h>
 #include <sys/lock.h>
+#include <sys/vnode.h>
 
 #include <uvm/uvm_extern.h>
 
@@ -608,6 +609,14 @@
 {
        int error;
 
+       if (rootvnode == NULL) {
+#ifdef DIAGNOSTIC
+               printf("%s: trying to load `%s' before root is mounted\n",
+                   __func__, filename);
+#endif
+               return;
+       }
+
        kernconfig_lock();
 
        /* Nothing if the user has disabled it. */



Home | Main Index | Thread Index | Old Index