aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@suse.de>2008-01-27 13:29:20 -0500
committerGreg Kroah-Hartman <gregkh@suse.de>2008-01-27 18:01:39 -0500
commit123ca9575b1f5342c05a4b84d6af8ba7587c2981 (patch)
tree3d058bc01640913d44d819d0a582d2e7cba82978
parent404aae5d420ec543e2e8434f7ec0edf5e2d2b0c4 (diff)
Module: check to see if we have a built in module with the same name
When trying to load a module with the same name as a built-in one, a scary kobject backtrace comes up. Prevent that from checking for this condition and warning the user as to what exactly is going on. Cc: Rusty Russell <rusty@rustcorp.com.au> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r--kernel/module.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/kernel/module.c b/kernel/module.c
index 1bb4c5e0d56e..76ddc85a423a 100644
--- a/kernel/module.c
+++ b/kernel/module.c
@@ -1214,6 +1214,7 @@ void module_remove_modinfo_attrs(struct module *mod)
1214int mod_sysfs_init(struct module *mod) 1214int mod_sysfs_init(struct module *mod)
1215{ 1215{
1216 int err; 1216 int err;
1217 struct kobject *kobj;
1217 1218
1218 if (!module_sysfs_initialized) { 1219 if (!module_sysfs_initialized) {
1219 printk(KERN_ERR "%s: module sysfs not initialized\n", 1220 printk(KERN_ERR "%s: module sysfs not initialized\n",
@@ -1221,6 +1222,15 @@ int mod_sysfs_init(struct module *mod)
1221 err = -EINVAL; 1222 err = -EINVAL;
1222 goto out; 1223 goto out;
1223 } 1224 }
1225
1226 kobj = kset_find_obj(module_kset, mod->name);
1227 if (kobj) {
1228 printk(KERN_ERR "%s: module is already loaded\n", mod->name);
1229 kobject_put(kobj);
1230 err = -EINVAL;
1231 goto out;
1232 }
1233
1224 mod->mkobj.mod = mod; 1234 mod->mkobj.mod = mod;
1225 1235
1226 memset(&mod->mkobj.kobj, 0, sizeof(mod->mkobj.kobj)); 1236 memset(&mod->mkobj.kobj, 0, sizeof(mod->mkobj.kobj));