diff options
Diffstat (limited to 'kernel/module.c')
-rw-r--r-- | kernel/module.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/kernel/module.c b/kernel/module.c index 5734ab09d3f9..83b3d376708c 100644 --- a/kernel/module.c +++ b/kernel/module.c | |||
@@ -1758,6 +1758,7 @@ sys_init_module(void __user *umod, | |||
1758 | const char __user *uargs) | 1758 | const char __user *uargs) |
1759 | { | 1759 | { |
1760 | struct module *mod; | 1760 | struct module *mod; |
1761 | mm_segment_t old_fs = get_fs(); | ||
1761 | int ret = 0; | 1762 | int ret = 0; |
1762 | 1763 | ||
1763 | /* Must have permission */ | 1764 | /* Must have permission */ |
@@ -1775,6 +1776,9 @@ sys_init_module(void __user *umod, | |||
1775 | return PTR_ERR(mod); | 1776 | return PTR_ERR(mod); |
1776 | } | 1777 | } |
1777 | 1778 | ||
1779 | /* flush the icache in correct context */ | ||
1780 | set_fs(KERNEL_DS); | ||
1781 | |||
1778 | /* Flush the instruction cache, since we've played with text */ | 1782 | /* Flush the instruction cache, since we've played with text */ |
1779 | if (mod->module_init) | 1783 | if (mod->module_init) |
1780 | flush_icache_range((unsigned long)mod->module_init, | 1784 | flush_icache_range((unsigned long)mod->module_init, |
@@ -1783,6 +1787,8 @@ sys_init_module(void __user *umod, | |||
1783 | flush_icache_range((unsigned long)mod->module_core, | 1787 | flush_icache_range((unsigned long)mod->module_core, |
1784 | (unsigned long)mod->module_core + mod->core_size); | 1788 | (unsigned long)mod->module_core + mod->core_size); |
1785 | 1789 | ||
1790 | set_fs(old_fs); | ||
1791 | |||
1786 | /* Now sew it into the lists. They won't access us, since | 1792 | /* Now sew it into the lists. They won't access us, since |
1787 | strong_try_module_get() will fail. */ | 1793 | strong_try_module_get() will fail. */ |
1788 | stop_machine_run(__link_module, mod, NR_CPUS); | 1794 | stop_machine_run(__link_module, mod, NR_CPUS); |