riscv: prevent null-pointer dereference with
From: Heiko Stuebner <heiko@...> Date: Fri, 10 Dec 2021 16:19:19 +0100
Commit-Message
The callback used inside sbi_remote_fence_i is set at sbi probe time to the needed variant. Before that it is a NULL pointer. Some users like the flush_icache_*() functions suggest a generic functionality, that doesn't depend on a specific boot-stage but uses sbi_remote_fence_i as one option to flush other cpu cores. So they definitly shouldn't run into null-pointer dereference issues when called "too early" during boot. So introduce an empty function to be the standard for the __sbi_rfence function pointer until sbi_init has run. Users of sbi_remote_fence_i will have separate code for the local cpu and sbi_init() is called before other cpus are brought up. So there are no other cpus present at the time when the issue might happen. Signed-off-by: Heiko Stuebner <heiko@...>
Patch-Comment
arch/riscv/kernel/sbi.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)
Statistics
- 9 lines added
- 1 lines removed