]> Gentwo Git Trees - linux/.git/commit
module: Use proper RCU assignment in add_kallsyms().
authorSebastian Andrzej Siewior <bigeasy@linutronix.de>
Wed, 8 Jan 2025 09:04:32 +0000 (10:04 +0100)
committerPetr Pavlu <petr.pavlu@suse.com>
Mon, 17 Feb 2025 09:43:32 +0000 (10:43 +0100)
commit58f036498fde7791bf21e2d52ace25e725d65b95
tree2c9c763fcd4a6ab1b2bbf98a393dbe379537777b
parent4ac044665d49e4afa06e2492c61c5ff95f02e9e0
module: Use proper RCU assignment in add_kallsyms().

add_kallsyms() assigns the RCU pointer module::kallsyms and setups the
structures behind it which point to init-data. The module was not
published yet, nothing can see the kallsyms pointer and the data behind
it. Also module's init function was not yet invoked.
There is no need to use rcu_dereference() here, it is just to keep
checkers quiet. The whole RCU read section is also not needed.

Use a local kallsyms pointer and setup the data structures. Assign that
pointer to the data structure at the end via rcu_assign_pointer().

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-4-bigeasy@linutronix.de
Signed-off-by: Petr Pavlu <petr.pavlu@suse.com>
kernel/module/kallsyms.c