aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/module.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/module.c')
-rw-r--r--kernel/module.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/kernel/module.c b/kernel/module.c
index fd1411403558..eccb561dd8a3 100644
--- a/kernel/module.c
+++ b/kernel/module.c
@@ -909,16 +909,18 @@ void __symbol_put(const char *symbol)
909} 909}
910EXPORT_SYMBOL(__symbol_put); 910EXPORT_SYMBOL(__symbol_put);
911 911
912/* Note this assumes addr is a function, which it currently always is. */
912void symbol_put_addr(void *addr) 913void symbol_put_addr(void *addr)
913{ 914{
914 struct module *modaddr; 915 struct module *modaddr;
916 unsigned long a = (unsigned long)dereference_function_descriptor(addr);
915 917
916 if (core_kernel_text((unsigned long)addr)) 918 if (core_kernel_text(a))
917 return; 919 return;
918 920
919 /* module_text_address is safe here: we're supposed to have reference 921 /* module_text_address is safe here: we're supposed to have reference
920 * to module from symbol_get, so it can't go away. */ 922 * to module from symbol_get, so it can't go away. */
921 modaddr = __module_text_address((unsigned long)addr); 923 modaddr = __module_text_address(a);
922 BUG_ON(!modaddr); 924 BUG_ON(!modaddr);
923 module_put(modaddr); 925 module_put(modaddr);
924} 926}
@@ -2353,7 +2355,8 @@ static noinline struct module *load_module(void __user *umod,
2353 if (err < 0) 2355 if (err < 0)
2354 goto unlink; 2356 goto unlink;
2355 add_sect_attrs(mod, hdr->e_shnum, secstrings, sechdrs); 2357 add_sect_attrs(mod, hdr->e_shnum, secstrings, sechdrs);
2356 add_notes_attrs(mod, hdr->e_shnum, secstrings, sechdrs); 2358 if (mod->sect_attrs)
2359 add_notes_attrs(mod, hdr->e_shnum, secstrings, sechdrs);
2357 2360
2358 /* Get rid of temporary copy */ 2361 /* Get rid of temporary copy */
2359 vfree(hdr); 2362 vfree(hdr);