diff options
author | Greg Kroah-Hartman <gregkh@suse.de> | 2008-01-27 15:38:40 -0800 |
---|---|---|
committer | Rusty Russell <rusty@rustcorp.com.au> | 2008-01-29 17:13:27 +1100 |
commit | 6494a93d55fad586238cc1940e846c6d03e1aaf6 (patch) | |
tree | 8f930c1064753ab478b879b5598952f1ae87e52e | |
parent | 0aa5bd52d0c49ca56d24584c646e6544ccbb3dc9 (diff) | |
download | kernel_samsung_tuna-6494a93d55fad586238cc1940e846c6d03e1aaf6.zip kernel_samsung_tuna-6494a93d55fad586238cc1940e846c6d03e1aaf6.tar.gz kernel_samsung_tuna-6494a93d55fad586238cc1940e846c6d03e1aaf6.tar.bz2 |
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>
-rw-r--r-- | kernel/module.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/kernel/module.c b/kernel/module.c index af3f81a..f6a4e72 100644 --- a/kernel/module.c +++ b/kernel/module.c @@ -1230,6 +1230,7 @@ void module_remove_modinfo_attrs(struct module *mod) int mod_sysfs_init(struct module *mod) { int err; + struct kobject *kobj; if (!module_sysfs_initialized) { printk(KERN_ERR "%s: module sysfs not initialized\n", @@ -1237,6 +1238,15 @@ int mod_sysfs_init(struct module *mod) err = -EINVAL; goto out; } + + kobj = kset_find_obj(module_kset, mod->name); + if (kobj) { + printk(KERN_ERR "%s: module is already loaded\n", mod->name); + kobject_put(kobj); + err = -EINVAL; + goto out; + } + mod->mkobj.mod = mod; memset(&mod->mkobj.kobj, 0, sizeof(mod->mkobj.kobj)); |