]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/commitdiff
module: Wait for RCU synchronizing before releasing a module
authorMasami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
Sun, 9 Nov 2014 22:56:29 +0000 (09:26 +1030)
committerRusty Russell <rusty@rustcorp.com.au>
Tue, 11 Nov 2014 06:37:44 +0000 (17:07 +1030)
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>
kernel/module.c

index 88cec1ddb1e3c516496b951ae192cba21ff80c90..331b03f6b4114ab28cc46e6c04194efa0d3d3d09 100644 (file)
@@ -3326,6 +3326,8 @@ static int load_module(struct load_info *info, const char __user *uargs,
        /* Unlink carefully: kallsyms could be walking list. */
        list_del_rcu(&mod->list);
        wake_up_all(&module_wq);
+       /* Wait for RCU synchronizing before releasing mod->list. */
+       synchronize_rcu();
        mutex_unlock(&module_mutex);
  free_module:
        module_deallocate(mod, info);