diff options
-rw-r--r-- | kernel/jump_label.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/kernel/jump_label.c b/kernel/jump_label.c index 9019f15deab2..52ebaca1b9fc 100644 --- a/kernel/jump_label.c +++ b/kernel/jump_label.c | |||
@@ -302,7 +302,7 @@ static int jump_label_add_module(struct module *mod) | |||
302 | continue; | 302 | continue; |
303 | 303 | ||
304 | key = iterk; | 304 | key = iterk; |
305 | if (__module_address(iter->key) == mod) { | 305 | if (within_module(iter->key, mod)) { |
306 | /* | 306 | /* |
307 | * Set key->entries to iter, but preserve JUMP_LABEL_TRUE_BRANCH. | 307 | * Set key->entries to iter, but preserve JUMP_LABEL_TRUE_BRANCH. |
308 | */ | 308 | */ |
@@ -339,7 +339,7 @@ static void jump_label_del_module(struct module *mod) | |||
339 | 339 | ||
340 | key = (struct static_key *)(unsigned long)iter->key; | 340 | key = (struct static_key *)(unsigned long)iter->key; |
341 | 341 | ||
342 | if (__module_address(iter->key) == mod) | 342 | if (within_module(iter->key, mod)) |
343 | continue; | 343 | continue; |
344 | 344 | ||
345 | prev = &key->next; | 345 | prev = &key->next; |
@@ -443,14 +443,16 @@ static void jump_label_update(struct static_key *key, int enable) | |||
443 | { | 443 | { |
444 | struct jump_entry *stop = __stop___jump_table; | 444 | struct jump_entry *stop = __stop___jump_table; |
445 | struct jump_entry *entry = jump_label_get_entries(key); | 445 | struct jump_entry *entry = jump_label_get_entries(key); |
446 | |||
447 | #ifdef CONFIG_MODULES | 446 | #ifdef CONFIG_MODULES |
448 | struct module *mod = __module_address((unsigned long)key); | 447 | struct module *mod; |
449 | 448 | ||
450 | __jump_label_mod_update(key, enable); | 449 | __jump_label_mod_update(key, enable); |
451 | 450 | ||
451 | preempt_disable(); | ||
452 | mod = __module_address((unsigned long)key); | ||
452 | if (mod) | 453 | if (mod) |
453 | stop = mod->jump_entries + mod->num_jump_entries; | 454 | stop = mod->jump_entries + mod->num_jump_entries; |
455 | preempt_enable(); | ||
454 | #endif | 456 | #endif |
455 | /* if there are no users, entry can be NULL */ | 457 | /* if there are no users, entry can be NULL */ |
456 | if (entry) | 458 | if (entry) |