[<prev] [next>] [day] [month] [year] [list]
Message-ID: <c1bf1cf0609221242x7daea179ha47fd44e3a807e0f@mail.gmail.com>
Date: Fri, 22 Sep 2006 12:42:43 -0700
From: "Ed Swierk" <eswierk@...stra.com>
To: linux-kernel@...r.kernel.org
Cc: rusty@...tcorp.com.au
Subject: [PATCH] load_module: no BUG if module_subsys uninitialized
Invoking load_module() before param_sysfs_init() is called crashes in
mod_sysfs_setup(), since the kset in module_subsys is not initialized
yet.
Another patch for the same symptom
(module_subsys-initialize-earlier.patch) moves param_sysfs_init() to
the subsys initcalls, but this is still not early enough in the boot
process in some cases. In particular, topology_init() causes
/sbin/hotplug to run, which requests net-pf-1 (the UNIX socket
protocol) which can be compiled as a module. Moving param_sysfs_init()
to the postcore initcalls fixes this particular race, but there might
well be other cases where a usermodehelper causes a module to load
earlier still.
The patch below makes load_module() return an error rather than
crashing the kernel if invoked before module_subsys is initialized.
--- linux-2.6.17.11.orig/kernel/module.c 2006-08-23
21:16:33.000000000 +0000
+++ linux-2.6.17.11/kernel/module.c 2006-09-22 05:19:03.000000000 +0000
@@ -998,6 +998,12 @@
{
int err;
+ if (!module_subsys.kset.subsys) {
+ printk(KERN_ERR "%s: module_subsys not initialized\n",
+ mod->name);
+ err = -EINVAL;
+ goto out;
+ }
memset(&mod->mkobj.kobj, 0, sizeof(mod->mkobj.kobj));
err = kobject_set_name(&mod->mkobj.kobj, "%s", mod->name);
if (err)
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists