diff options
Diffstat (limited to 'kernel/module.c')
-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 af3f81a94745..f6a4e721fd49 100644 --- a/kernel/module.c +++ b/kernel/module.c | |||
@@ -1230,6 +1230,7 @@ void module_remove_modinfo_attrs(struct module *mod) | |||
1230 | int mod_sysfs_init(struct module *mod) | 1230 | int 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)); |