Commit a8f97595 authored by Rusty Russell's avatar Rusty Russell Committed by Linus Torvalds

[PATCH] Fix for module initialization failure

Bug reported by Paul Mackerras: if a module parameter fails, we didn't
call module_arch_cleanup().

On x86 this was harmless (module_arch_cleanup() is a no-op), but on
other architectures like PPC this causes inconsistent data structures
and subsequent oopses.
parent 6b90e276
...@@ -1658,7 +1658,7 @@ static struct module *load_module(void __user *umod, ...@@ -1658,7 +1658,7 @@ static struct module *load_module(void __user *umod,
NULL); NULL);
} }
if (err < 0) if (err < 0)
goto cleanup; goto arch_cleanup;
/* Get rid of temporary copy */ /* Get rid of temporary copy */
vfree(hdr); vfree(hdr);
...@@ -1666,6 +1666,8 @@ static struct module *load_module(void __user *umod, ...@@ -1666,6 +1666,8 @@ static struct module *load_module(void __user *umod,
/* Done! */ /* Done! */
return mod; return mod;
arch_cleanup:
module_arch_cleanup(mod);
cleanup: cleanup:
module_unload_free(mod); module_unload_free(mod);
module_free(mod, mod->module_init); module_free(mod, mod->module_init);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment