diff options
Diffstat (limited to 'kernel/module.c')
-rw-r--r-- | kernel/module.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/kernel/module.c b/kernel/module.c index b1821438694e..46580edff0cb 100644 --- a/kernel/module.c +++ b/kernel/module.c | |||
@@ -914,16 +914,18 @@ void __symbol_put(const char *symbol) | |||
914 | } | 914 | } |
915 | EXPORT_SYMBOL(__symbol_put); | 915 | EXPORT_SYMBOL(__symbol_put); |
916 | 916 | ||
917 | /* Note this assumes addr is a function, which it currently always is. */ | ||
917 | void symbol_put_addr(void *addr) | 918 | void symbol_put_addr(void *addr) |
918 | { | 919 | { |
919 | struct module *modaddr; | 920 | struct module *modaddr; |
921 | unsigned long a = (unsigned long)dereference_function_descriptor(addr); | ||
920 | 922 | ||
921 | if (core_kernel_text((unsigned long)addr)) | 923 | if (core_kernel_text(a)) |
922 | return; | 924 | return; |
923 | 925 | ||
924 | /* module_text_address is safe here: we're supposed to have reference | 926 | /* module_text_address is safe here: we're supposed to have reference |
925 | * to module from symbol_get, so it can't go away. */ | 927 | * to module from symbol_get, so it can't go away. */ |
926 | modaddr = __module_text_address((unsigned long)addr); | 928 | modaddr = __module_text_address(a); |
927 | BUG_ON(!modaddr); | 929 | BUG_ON(!modaddr); |
928 | module_put(modaddr); | 930 | module_put(modaddr); |
929 | } | 931 | } |
@@ -1279,6 +1281,10 @@ static void add_notes_attrs(struct module *mod, unsigned int nsect, | |||
1279 | struct module_notes_attrs *notes_attrs; | 1281 | struct module_notes_attrs *notes_attrs; |
1280 | struct bin_attribute *nattr; | 1282 | struct bin_attribute *nattr; |
1281 | 1283 | ||
1284 | /* failed to create section attributes, so can't create notes */ | ||
1285 | if (!mod->sect_attrs) | ||
1286 | return; | ||
1287 | |||
1282 | /* Count notes sections and allocate structures. */ | 1288 | /* Count notes sections and allocate structures. */ |
1283 | notes = 0; | 1289 | notes = 0; |
1284 | for (i = 0; i < nsect; i++) | 1290 | for (i = 0; i < nsect; i++) |