diff options
author | Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com> | 2014-11-09 17:57:29 -0500 |
---|---|---|
committer | Rusty Russell <rusty@rustcorp.com.au> | 2014-11-11 01:37:45 -0500 |
commit | 461e34aed0550fee706a9a28fb453830b5079ea0 (patch) | |
tree | 6a0a337bc67f6c1347866a7feceebfcf135cfcc2 /kernel/module.c | |
parent | 4f48795b6154852d07d971e402c35ecc460ddcb6 (diff) |
module: Unlink module with RCU synchronizing instead of stop_machine
Unlink module from module list with RCU synchronizing instead
of using stop_machine(). Since module list is already protected
by rcu, we don't need stop_machine() anymore.
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.c | 18 |
1 files changed, 5 insertions, 13 deletions
diff --git a/kernel/module.c b/kernel/module.c index 331b03f6b411..bed608b8c8a6 100644 --- a/kernel/module.c +++ b/kernel/module.c | |||
@@ -1697,18 +1697,6 @@ static void mod_sysfs_teardown(struct module *mod) | |||
1697 | mod_sysfs_fini(mod); | 1697 | mod_sysfs_fini(mod); |
1698 | } | 1698 | } |
1699 | 1699 | ||
1700 | /* | ||
1701 | * unlink the module with the whole machine is stopped with interrupts off | ||
1702 | * - this defends against kallsyms not taking locks | ||
1703 | */ | ||
1704 | static int __unlink_module(void *_mod) | ||
1705 | { | ||
1706 | struct module *mod = _mod; | ||
1707 | list_del(&mod->list); | ||
1708 | module_bug_cleanup(mod); | ||
1709 | return 0; | ||
1710 | } | ||
1711 | |||
1712 | #ifdef CONFIG_DEBUG_SET_MODULE_RONX | 1700 | #ifdef CONFIG_DEBUG_SET_MODULE_RONX |
1713 | /* | 1701 | /* |
1714 | * LKM RO/NX protection: protect module's text/ro-data | 1702 | * LKM RO/NX protection: protect module's text/ro-data |
@@ -1860,7 +1848,11 @@ static void free_module(struct module *mod) | |||
1860 | 1848 | ||
1861 | /* Now we can delete it from the lists */ | 1849 | /* Now we can delete it from the lists */ |
1862 | mutex_lock(&module_mutex); | 1850 | mutex_lock(&module_mutex); |
1863 | stop_machine(__unlink_module, mod, NULL); | 1851 | /* Unlink carefully: kallsyms could be walking list. */ |
1852 | list_del_rcu(&mod->list); | ||
1853 | /* Wait for RCU synchronizing before releasing mod->list. */ | ||
1854 | synchronize_rcu(); | ||
1855 | module_bug_cleanup(mod); | ||
1864 | mutex_unlock(&module_mutex); | 1856 | mutex_unlock(&module_mutex); |
1865 | 1857 | ||
1866 | /* This may be NULL, but that's OK */ | 1858 | /* This may be NULL, but that's OK */ |