aboutsummaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@suse.de>2008-01-27 18:38:40 -0500
committerRusty Russell <rusty@rustcorp.com.au>2008-01-29 01:13:27 -0500
commit6494a93d55fad586238cc1940e846c6d03e1aaf6 (patch)
tree8f930c1064753ab478b879b5598952f1ae87e52e /kernel
parent0aa5bd52d0c49ca56d24584c646e6544ccbb3dc9 (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> Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Diffstat (limited to 'kernel')
-rw-r--r--kernel/module.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/kernel/module.c b/kernel/module.c
index af3f81a94745..f6a4e721fd49 100644
--- a/kernel/module.c
+++ b/kernel/module.c
@@ -1230,6 +1230,7 @@ void module_remove_modinfo_attrs(struct module *mod)
1230int mod_sysfs_init(struct module *mod) 1230int mod_sysfs_init(struct module *mod)
1231{ 1231{
1232 int err; 1232 int err;
1233 struct kobject *kobj;
1233 1234
1234 if (!module_sysfs_initialized) { 1235 if (!module_sysfs_initialized) {
1235 printk(KERN_ERR "%s: module sysfs not initialized\n", 1236 printk(KERN_ERR "%s: module sysfs not initialized\n",
@@ -1237,6 +1238,15 @@ int mod_sysfs_init(struct module *mod)
1237 err = -EINVAL; 1238 err = -EINVAL;
1238 goto out; 1239 goto out;
1239 } 1240 }
1241
1242 kobj = kset_find_obj(module_kset, mod->name);
1243 if (kobj) {
1244 printk(KERN_ERR "%s: module is already loaded\n", mod->name);
1245 kobject_put(kobj);
1246 err = -EINVAL;
1247 goto out;
1248 }
1249
1240 mod->mkobj.mod = mod; 1250 mod->mkobj.mod = mod;
1241 1251
1242 memset(&mod->mkobj.kobj, 0, sizeof(mod->mkobj.kobj)); 1252 memset(&mod->mkobj.kobj, 0, sizeof(mod->mkobj.kobj));