module: Use RCU in find_symbol().
module_assert_mutex_or_preempt() is not needed in find_symbol(). The function checks for RCU-sched or the module_mutex to be acquired. The list_for_each_entry_rcu() below does the same check. Remove module_assert_mutex_or_preempt() from try_add_tainted_module(). Use RCU protection to invoke find_symbol() and update callers. 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-11-bigeasy@linutronix.de Signed-off-by: Petr Pavlu <petr.pavlu@suse.com>
This commit is contained in:
committed by
Petr Pavlu
parent
435bbcc3be
commit
2ff49f8931
@@ -79,17 +79,17 @@ int check_modstruct_version(const struct load_info *info,
|
||||
.name = "module_layout",
|
||||
.gplok = true,
|
||||
};
|
||||
bool have_symbol;
|
||||
|
||||
/*
|
||||
* Since this should be found in kernel (which can't be removed), no
|
||||
* locking is necessary -- use preempt_disable() to placate lockdep.
|
||||
* locking is necessary. Regardless use a RCU read section to keep
|
||||
* lockdep happy.
|
||||
*/
|
||||
preempt_disable();
|
||||
if (!find_symbol(&fsa)) {
|
||||
preempt_enable();
|
||||
BUG();
|
||||
}
|
||||
preempt_enable();
|
||||
scoped_guard(rcu)
|
||||
have_symbol = find_symbol(&fsa);
|
||||
BUG_ON(!have_symbol);
|
||||
|
||||
return check_version(info, "module_layout", mod, fsa.crc);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user