diff options
-rw-r--r-- | kernel/module.c | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/kernel/module.c b/kernel/module.c index 330f64e7e193..32d0d32abbf6 100644 --- a/kernel/module.c +++ b/kernel/module.c | |||
@@ -4170,22 +4170,23 @@ const struct exception_table_entry *search_module_extables(unsigned long addr) | |||
4170 | struct module *mod; | 4170 | struct module *mod; |
4171 | 4171 | ||
4172 | preempt_disable(); | 4172 | preempt_disable(); |
4173 | list_for_each_entry_rcu(mod, &modules, list) { | 4173 | mod = __module_address(addr); |
4174 | if (mod->state == MODULE_STATE_UNFORMED) | 4174 | if (!mod) |
4175 | continue; | 4175 | goto out; |
4176 | if (mod->num_exentries == 0) | ||
4177 | continue; | ||
4178 | 4176 | ||
4179 | e = search_extable(mod->extable, | 4177 | if (!mod->num_exentries) |
4180 | mod->extable + mod->num_exentries - 1, | 4178 | goto out; |
4181 | addr); | 4179 | |
4182 | if (e) | 4180 | e = search_extable(mod->extable, |
4183 | break; | 4181 | mod->extable + mod->num_exentries - 1, |
4184 | } | 4182 | addr); |
4183 | out: | ||
4185 | preempt_enable(); | 4184 | preempt_enable(); |
4186 | 4185 | ||
4187 | /* Now, if we found one, we are running inside it now, hence | 4186 | /* |
4188 | we cannot unload the module, hence no refcnt needed. */ | 4187 | * Now, if we found one, we are running inside it now, hence |
4188 | * we cannot unload the module, hence no refcnt needed. | ||
4189 | */ | ||
4189 | return e; | 4190 | return e; |
4190 | } | 4191 | } |
4191 | 4192 | ||