diff options
author | Kay Sievers <kay.sievers@vrfy.org> | 2007-11-29 17:46:11 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2008-01-24 23:40:36 -0500 |
commit | 97c146ef075dc40ae34407c03d3860fc3850b8e8 (patch) | |
tree | df4346fbbf9f7129fbd929ce43ceac819ff3c7df /kernel | |
parent | da231fd5d113ab6da5dab7a2d2c38d0a540f939c (diff) |
sysfs: fix /sys/module/*/holders after sysfs logic change
Sysfs symlinks now require fully registered kobjects as a target,
otherwise the call to create a symlink will fail. Here we register
the kobject before we request the symlink in the holders directory.
Signed-off-by: Kay Sievers <kay.sievers@vrfy.org>
Cc: Tejun Heo <teheo@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/module.c | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/kernel/module.c b/kernel/module.c index dc4d3f5ce820..0ae811785c59 100644 --- a/kernel/module.c +++ b/kernel/module.c | |||
@@ -1227,6 +1227,8 @@ int mod_sysfs_init(struct module *mod) | |||
1227 | 1227 | ||
1228 | kobject_init(&mod->mkobj.kobj); | 1228 | kobject_init(&mod->mkobj.kobj); |
1229 | 1229 | ||
1230 | /* delay uevent until full sysfs population */ | ||
1231 | err = kobject_add(&mod->mkobj.kobj); | ||
1230 | out: | 1232 | out: |
1231 | return err; | 1233 | return err; |
1232 | } | 1234 | } |
@@ -1237,11 +1239,6 @@ int mod_sysfs_setup(struct module *mod, | |||
1237 | { | 1239 | { |
1238 | int err; | 1240 | int err; |
1239 | 1241 | ||
1240 | /* delay uevent until full sysfs population */ | ||
1241 | err = kobject_add(&mod->mkobj.kobj); | ||
1242 | if (err) | ||
1243 | goto out; | ||
1244 | |||
1245 | mod->holders_dir = kobject_create_and_add("holders", &mod->mkobj.kobj); | 1242 | mod->holders_dir = kobject_create_and_add("holders", &mod->mkobj.kobj); |
1246 | if (!mod->holders_dir) { | 1243 | if (!mod->holders_dir) { |
1247 | err = -ENOMEM; | 1244 | err = -ENOMEM; |
@@ -1266,7 +1263,6 @@ out_unreg_holders: | |||
1266 | out_unreg: | 1263 | out_unreg: |
1267 | kobject_del(&mod->mkobj.kobj); | 1264 | kobject_del(&mod->mkobj.kobj); |
1268 | kobject_put(&mod->mkobj.kobj); | 1265 | kobject_put(&mod->mkobj.kobj); |
1269 | out: | ||
1270 | return err; | 1266 | return err; |
1271 | } | 1267 | } |
1272 | #endif | 1268 | #endif |
@@ -1883,10 +1879,10 @@ static struct module *load_module(void __user *umod, | |||
1883 | /* Now we've moved module, initialize linked lists, etc. */ | 1879 | /* Now we've moved module, initialize linked lists, etc. */ |
1884 | module_unload_init(mod); | 1880 | module_unload_init(mod); |
1885 | 1881 | ||
1886 | /* Initialize kobject, so we can reference it. */ | 1882 | /* add kobject, so we can reference it. */ |
1887 | err = mod_sysfs_init(mod); | 1883 | err = mod_sysfs_init(mod); |
1888 | if (err) | 1884 | if (err) |
1889 | goto cleanup; | 1885 | goto free_unload; |
1890 | 1886 | ||
1891 | /* Set up license info based on the info section */ | 1887 | /* Set up license info based on the info section */ |
1892 | set_license(mod, get_modinfo(sechdrs, infoindex, "license")); | 1888 | set_license(mod, get_modinfo(sechdrs, infoindex, "license")); |
@@ -2056,6 +2052,9 @@ static struct module *load_module(void __user *umod, | |||
2056 | arch_cleanup: | 2052 | arch_cleanup: |
2057 | module_arch_cleanup(mod); | 2053 | module_arch_cleanup(mod); |
2058 | cleanup: | 2054 | cleanup: |
2055 | kobject_del(&mod->mkobj.kobj); | ||
2056 | kobject_put(&mod->mkobj.kobj); | ||
2057 | free_unload: | ||
2059 | module_unload_free(mod); | 2058 | module_unload_free(mod); |
2060 | module_free(mod, mod->module_init); | 2059 | module_free(mod, mod->module_init); |
2061 | free_core: | 2060 | free_core: |