mirror of
https://github.com/torvalds/linux.git
synced 2026-01-24 23:16:46 +00:00
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 <bigeasy@linutronix.de> Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org> Link: https://lore.kernel.org/r/20250108090457.512198-12-bigeasy@linutronix.de Signed-off-by: Petr Pavlu <petr.pavlu@suse.com>
This commit is contained in:
committed by
Petr Pavlu
parent
2ff49f8931
commit
2bee017741
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user