aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/module.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2017-02-22 20:08:33 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2017-02-22 20:08:33 -0500
commit6ef192f2259e78e1870c509fbd3040e6752b3b9c (patch)
tree61530c9059819327e82e72c70a8b1ee4c3559b47 /kernel/module.c
parent37c85961c3f87f2141c84e53df31e59db072fd2e (diff)
parent0d4ec7849f5a197d46c062a49f47ed326dd0388c (diff)
Merge tag 'modules-for-v4.11' of git://git.kernel.org/pub/scm/linux/kernel/git/jeyu/linux
Pull modules updates from Jessica Yu: "Summary of modules changes for the 4.11 merge window: - A few small code cleanups - Add modules git tree url to MAINTAINERS" * tag 'modules-for-v4.11' of git://git.kernel.org/pub/scm/linux/kernel/git/jeyu/linux: MAINTAINERS: add tree for modules module: fix memory leak on early load_module() failures module: Optimize search_module_extables() modules: mark __inittest/__exittest as __maybe_unused livepatch/module: print notice of TAINT_LIVEPATCH module: Drop redundant declaration of struct module
Diffstat (limited to 'kernel/module.c')
-rw-r--r--kernel/module.c30
1 files changed, 17 insertions, 13 deletions
diff --git a/kernel/module.c b/kernel/module.c
index a3889169a3ae..7eba6dea4f41 100644
--- a/kernel/module.c
+++ b/kernel/module.c
@@ -2811,6 +2811,8 @@ static int check_modinfo_livepatch(struct module *mod, struct load_info *info)
2811 if (get_modinfo(info, "livepatch")) { 2811 if (get_modinfo(info, "livepatch")) {
2812 mod->klp = true; 2812 mod->klp = true;
2813 add_taint_module(mod, TAINT_LIVEPATCH, LOCKDEP_STILL_OK); 2813 add_taint_module(mod, TAINT_LIVEPATCH, LOCKDEP_STILL_OK);
2814 pr_notice_once("%s: tainting kernel with TAINT_LIVEPATCH\n",
2815 mod->name);
2814 } 2816 }
2815 2817
2816 return 0; 2818 return 0;
@@ -3723,6 +3725,7 @@ static int load_module(struct load_info *info, const char __user *uargs,
3723 mod_sysfs_teardown(mod); 3725 mod_sysfs_teardown(mod);
3724 coming_cleanup: 3726 coming_cleanup:
3725 mod->state = MODULE_STATE_GOING; 3727 mod->state = MODULE_STATE_GOING;
3728 destroy_params(mod->kp, mod->num_kp);
3726 blocking_notifier_call_chain(&module_notify_list, 3729 blocking_notifier_call_chain(&module_notify_list,
3727 MODULE_STATE_GOING, mod); 3730 MODULE_STATE_GOING, mod);
3728 klp_module_going(mod); 3731 klp_module_going(mod);
@@ -4169,22 +4172,23 @@ const struct exception_table_entry *search_module_extables(unsigned long addr)
4169 struct module *mod; 4172 struct module *mod;
4170 4173
4171 preempt_disable(); 4174 preempt_disable();
4172 list_for_each_entry_rcu(mod, &modules, list) { 4175 mod = __module_address(addr);
4173 if (mod->state == MODULE_STATE_UNFORMED) 4176 if (!mod)
4174 continue; 4177 goto out;
4175 if (mod->num_exentries == 0)
4176 continue;
4177 4178
4178 e = search_extable(mod->extable, 4179 if (!mod->num_exentries)
4179 mod->extable + mod->num_exentries - 1, 4180 goto out;
4180 addr); 4181
4181 if (e) 4182 e = search_extable(mod->extable,
4182 break; 4183 mod->extable + mod->num_exentries - 1,
4183 } 4184 addr);
4185out:
4184 preempt_enable(); 4186 preempt_enable();
4185 4187
4186 /* Now, if we found one, we are running inside it now, hence 4188 /*
4187 we cannot unload the module, hence no refcnt needed. */ 4189 * Now, if we found one, we are running inside it now, hence
4190 * we cannot unload the module, hence no refcnt needed.
4191 */
4188 return e; 4192 return e;
4189} 4193}
4190 4194