diff options
Diffstat (limited to 'kernel/module.c')
-rw-r--r-- | kernel/module.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/kernel/module.c b/kernel/module.c index 281172f01e9a..0351625767b1 100644 --- a/kernel/module.c +++ b/kernel/module.c | |||
@@ -2159,6 +2159,29 @@ const struct exception_table_entry *search_module_extables(unsigned long addr) | |||
2159 | return e; | 2159 | return e; |
2160 | } | 2160 | } |
2161 | 2161 | ||
2162 | /* | ||
2163 | * Is this a valid module address? | ||
2164 | */ | ||
2165 | int is_module_address(unsigned long addr) | ||
2166 | { | ||
2167 | unsigned long flags; | ||
2168 | struct module *mod; | ||
2169 | |||
2170 | spin_lock_irqsave(&modlist_lock, flags); | ||
2171 | |||
2172 | list_for_each_entry(mod, &modules, list) { | ||
2173 | if (within(addr, mod->module_core, mod->core_size)) { | ||
2174 | spin_unlock_irqrestore(&modlist_lock, flags); | ||
2175 | return 1; | ||
2176 | } | ||
2177 | } | ||
2178 | |||
2179 | spin_unlock_irqrestore(&modlist_lock, flags); | ||
2180 | |||
2181 | return 0; | ||
2182 | } | ||
2183 | |||
2184 | |||
2162 | /* Is this a valid kernel address? We don't grab the lock: we are oopsing. */ | 2185 | /* Is this a valid kernel address? We don't grab the lock: we are oopsing. */ |
2163 | struct module *__module_text_address(unsigned long addr) | 2186 | struct module *__module_text_address(unsigned long addr) |
2164 | { | 2187 | { |