From: Sebastian Andrzej Siewior Date: Wed, 8 Jan 2025 09:04:40 +0000 (+0100) Subject: module: Use RCU in __is_module_percpu_address(). X-Git-Tag: v6.15-rc1~94^2~21 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=2bee017741f2890131da2fac96c3f2b64cb947b0;p=thirdparty%2Flinux.git module: Use RCU in __is_module_percpu_address(). The modules list can be accessed under RCU assumption. Use RCU protection instead preempt_disable(). Signed-off-by: Sebastian Andrzej Siewior Acked-by: Peter Zijlstra (Intel) Link: https://lore.kernel.org/r/20250108090457.512198-12-bigeasy@linutronix.de Signed-off-by: Petr Pavlu --- diff --git a/kernel/module/main.c b/kernel/module/main.c index af7ca713eff0a..5d6f44c09bec2 100644 --- a/kernel/module/main.c +++ b/kernel/module/main.c @@ -450,8 +450,7 @@ bool __is_module_percpu_address(unsigned long addr, unsigned long *can_addr) struct module *mod; unsigned int cpu; - preempt_disable(); - + guard(rcu)(); list_for_each_entry_rcu(mod, &modules, list) { if (mod->state == MODULE_STATE_UNFORMED) continue; @@ -468,13 +467,10 @@ bool __is_module_percpu_address(unsigned long addr, unsigned long *can_addr) per_cpu_ptr(mod->percpu, get_boot_cpu_id()); } - preempt_enable(); return true; } } } - - preempt_enable(); return false; }