diff options
author | 2025-01-08 10:04:41 +0100 | |
---|---|---|
committer | 2025-03-10 11:54:45 +0100 | |
commit | 7d9dda6f628fde3d227a69bec6a82160577b79ca (patch) | |
tree | d1ad10072b128b028dd597f77c675a47f977a809 /kernel/module/main.c | |
parent | module: Use RCU in __is_module_percpu_address(). (diff) | |
download | wireguard-linux-7d9dda6f628fde3d227a69bec6a82160577b79ca.tar.xz wireguard-linux-7d9dda6f628fde3d227a69bec6a82160577b79ca.zip |
module: Allow __module_address() to be called from RCU section.
mod_find() uses either the modules list to find a module or a tree
lookup (CONFIG_MODULES_TREE_LOOKUP). The list and the tree can both be
iterated under RCU assumption (as well as RCU-sched).
Remove module_assert_mutex_or_preempt() from __module_address() and
entirely since __module_address() is the last user.
Update comments.
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-13-bigeasy@linutronix.de
Signed-off-by: Petr Pavlu <petr.pavlu@suse.com>
Diffstat (limited to 'kernel/module/main.c')
-rw-r--r-- | kernel/module/main.c | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/kernel/module/main.c b/kernel/module/main.c index 5d6f44c09bec..2155814f35dd 100644 --- a/kernel/module/main.c +++ b/kernel/module/main.c @@ -3749,7 +3749,7 @@ bool is_module_address(unsigned long addr) * __module_address() - get the module which contains an address. * @addr: the address. * - * Must be called with preempt disabled or module mutex held so that + * Must be called within RCU read section or module mutex held so that * module doesn't get freed during this. */ struct module *__module_address(unsigned long addr) @@ -3767,8 +3767,6 @@ struct module *__module_address(unsigned long addr) return NULL; lookup: - module_assert_mutex_or_preempt(); - mod = mod_find(addr, &mod_tree); if (mod) { BUG_ON(!within_module(addr, mod)); |