riscv: Safely remove entries from relocation list
authorCharlie Jenkins <charlie@rivosinc.com>
Mon, 27 Nov 2023 22:04:59 +0000 (14:04 -0800)
committerPalmer Dabbelt <palmer@rivosinc.com>
Mon, 4 Dec 2023 19:02:37 +0000 (11:02 -0800)
commitd8792a5734b0f3e58b898c2e2f910bfac48e9ee3
tree2c619d9d155e66ab882243f5f6c15120888e8f29
parentb85ea95d086471afb4ad062012a4d73cd328fa86
riscv: Safely remove entries from relocation list

Use the safe versions of list and hlist iteration to safely remove
entries from the module relocation lists. To allow mutliple threads to
load modules concurrently, move relocation list pointers onto the stack
rather than using global variables.

Fixes: 8fd6c5142395 ("riscv: Add remaining module relocations")
Reported-by: Ron Economos <re@w6rz.net>
Closes: https://lore.kernel.org/linux-riscv/444de86a-7e7c-4de7-5d1d-c1c40eefa4ba@w6rz.net
Signed-off-by: Charlie Jenkins <charlie@rivosinc.com>
Tested-by: Björn Töpel <bjorn@rivosinc.com>
Link: https://lore.kernel.org/r/20231127-module_linking_freeing-v4-1-a2ca1d7027d0@rivosinc.com
Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
arch/riscv/kernel/module.c