aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/module.c
diff options
context:
space:
mode:
authorMasami Hiramatsu <masami.hiramatsu.pt@hitachi.com>2014-11-09 17:56:29 -0500
committerRusty Russell <rusty@rustcorp.com.au>2014-11-11 01:37:44 -0500
commit4f48795b6154852d07d971e402c35ecc460ddcb6 (patch)
tree65ae9d457d88034c8105d1a94082653b90ca88d2 /kernel/module.c
parent0df1f2487d2f0d04703f142813d53615d62a1da4 (diff)
module: Wait for RCU synchronizing before releasing a module
Wait for RCU synchronizing on failure path of module loading before releasing struct module, because the memory of mod->list can still be accessed by list walkers (e.g. kallsyms). Signed-off-by: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com> Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Diffstat (limited to 'kernel/module.c')
-rw-r--r--kernel/module.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/kernel/module.c b/kernel/module.c
index 88cec1ddb1e3..331b03f6b411 100644
--- a/kernel/module.c
+++ b/kernel/module.c
@@ -3326,6 +3326,8 @@ static int load_module(struct load_info *info, const char __user *uargs,
3326 /* Unlink carefully: kallsyms could be walking list. */ 3326 /* Unlink carefully: kallsyms could be walking list. */
3327 list_del_rcu(&mod->list); 3327 list_del_rcu(&mod->list);
3328 wake_up_all(&module_wq); 3328 wake_up_all(&module_wq);
3329 /* Wait for RCU synchronizing before releasing mod->list. */
3330 synchronize_rcu();
3329 mutex_unlock(&module_mutex); 3331 mutex_unlock(&module_mutex);
3330 free_module: 3332 free_module:
3331 module_deallocate(mod, info); 3333 module_deallocate(mod, info);