Skip to content

Commit

Permalink
module: return error when mod_sysfs_init() failed
Browse files Browse the repository at this point in the history
load_module() returns zero when mod_sysfs_init() fails, then the module
loading will succeed accidentally.

This patch makes load_module() return error correctly in that case.

Acked-by: Greg Kroah-Hartman <[email protected]>
Acked-by: Rusty Russell <[email protected]>
Signed-off-by: Akinobu Mita <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
mita authored and Linus Torvalds committed Oct 17, 2007
1 parent 22d2b35 commit d58ae67
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion kernel/module.c
Original file line number Diff line number Diff line change
Expand Up @@ -1881,7 +1881,8 @@ static struct module *load_module(void __user *umod,
module_unload_init(mod);

/* Initialize kobject, so we can reference it. */
if (mod_sysfs_init(mod) != 0)
err = mod_sysfs_init(mod);
if (err)
goto cleanup;

/* Set up license info based on the info section */
Expand Down

0 comments on commit d58ae67

Please sign in to comment.