diff options
| author | Sebastian Andrzej Siewior <bigeasy@linutronix.de> | 2025-01-08 10:04:56 +0100 |
|---|---|---|
| committer | Petr Pavlu <petr.pavlu@suse.com> | 2025-03-10 11:54:46 +0100 |
| commit | 3983da398c26962e1d7ce691e83c968f7587d285 (patch) | |
| tree | 43219d74b95ad52541e6a7521fa757f751a33fea /kernel/static_call_inline.c | |
| parent | 7e74a7c00aefdcd0941d98873fce402d93ef07dc (diff) | |
static_call: Use RCU in all users of __module_text_address().
__module_text_address() can be invoked within a RCU section, there is no
requirement to have preemption disabled.
Replace the preempt_disable() section around __module_text_address()
with RCU.
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://lore.kernel.org/r/20250108090457.512198-28-bigeasy@linutronix.de
Signed-off-by: Petr Pavlu <petr.pavlu@suse.com>
Diffstat (limited to 'kernel/static_call_inline.c')
| -rw-r--r-- | kernel/static_call_inline.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/kernel/static_call_inline.c b/kernel/static_call_inline.c index bb7d066a7c39..c2c59e6ef35d 100644 --- a/kernel/static_call_inline.c +++ b/kernel/static_call_inline.c @@ -325,13 +325,12 @@ static int __static_call_mod_text_reserved(void *start, void *end) struct module *mod; int ret; - preempt_disable(); - mod = __module_text_address((unsigned long)start); - WARN_ON_ONCE(__module_text_address((unsigned long)end) != mod); - if (!try_module_get(mod)) - mod = NULL; - preempt_enable(); - + scoped_guard(rcu) { + mod = __module_text_address((unsigned long)start); + WARN_ON_ONCE(__module_text_address((unsigned long)end) != mod); + if (!try_module_get(mod)) + mod = NULL; + } if (!mod) return 0; |