[PATCH] module: Call module notifier on failure after complete_formation()

From: Steven Rostedt
Date: Fri May 08 2015 - 11:17:45 EST

The module notifier call chain for MODULE_STATE_COMING was moved up before
the parsing of args, into the complete_formation() call. But if the module failed
to load after that, the notifier call chain for MODULE_STATE_GOING was
never called and that prevented the users of those call chains from
cleaning up anything that was allocated.

Link: http://lkml.kernel.org/r/554C52B9.9060700@xxxxxxxxx

Reported-by: Pontus Fuchs <pontus.fuchs@xxxxxxxxx>
Fixes: 4982223e51e8 "module: set nx before marking module MODULE_STATE_COMING"
Cc: stable@xxxxxxxxxxxxxxx # 3.16+
Signed-off-by: Steven Rostedt <rostedt@xxxxxxxxxxx>
kernel/module.c | 3 +++
1 file changed, 3 insertions(+)

diff --git a/kernel/module.c b/kernel/module.c
index 42a1d2afb217..cfc9e843a924 100644
--- a/kernel/module.c
+++ b/kernel/module.c
@@ -3370,6 +3370,9 @@ static int load_module(struct load_info *info, const char __user *uargs,

+ blocking_notifier_call_chain(&module_notify_list,
/* we can't deallocate the module until we clear memory protection */

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/