Skip to content

Commit d58ae67

Browse files
mitaLinus Torvalds
authored andcommitted
module: return error when mod_sysfs_init() failed
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]>
1 parent 22d2b35 commit d58ae67

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

kernel/module.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1881,7 +1881,8 @@ static struct module *load_module(void __user *umod,
18811881
module_unload_init(mod);
18821882

18831883
/* Initialize kobject, so we can reference it. */
1884-
if (mod_sysfs_init(mod) != 0)
1884+
err = mod_sysfs_init(mod);
1885+
if (err)
18851886
goto cleanup;
18861887

18871888
/* Set up license info based on the info section */

0 commit comments

Comments
 (0)