patch-2.1.106 linux/kernel/kmod.c

Next file: linux/kernel/ksyms.c
Previous file: linux/kernel/fork.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.1.105/linux/kernel/kmod.c linux/kernel/kmod.c
@@ -93,6 +93,13 @@
 	int pid;
 	int waitpid_result;
 
+	/* Don't allow request_module() before the root fs is mounted!  */
+	if ( ! current->fs->root ) {
+		printk(KERN_ERR "request_module[%s]: Root fs not mounted\n",
+			module_name);
+		return -EPERM;
+	}
+
 	pid = kernel_thread(exec_modprobe, (void*) module_name, CLONE_FS);
 	if (pid < 0) {
 		printk(KERN_ERR "kmod: fork failed, errno %d\n", -pid);

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov