summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorJiakai Xu <xujiakai2025@iscas.ac.cn>2026-05-17 12:44:14 +0000
committerAnup Patel <anup@brainfault.org>2026-05-18 10:19:18 +0530
commitfdb69d401967fd88d27982a7e4984b2a3a4f0314 (patch)
treec86e6cee54473319c6b0c74f01c0ebb32464c3a4 /include
parent0e9d0e7a7c78db7aa1c13796c65cfe0aefa54a5b (diff)
RISC-V: KVM: Fix NULL pointer dereference in SBI v0.1 SEND_IPI handler
The SBI v0.1 SEND_IPI handler iterates over the hart mask and calls kvm_get_vcpu_by_id() to find the target vcpu for each set bit. When a guest provides a hart mask containing bits for non-existent vcpu_ids, kvm_get_vcpu_by_id() returns NULL, which is then unconditionally dereferenced by kvm_riscv_vcpu_set_interrupt(), causing a kernel crash. Fix this by adding a NULL check before dereferencing the return value. If the target vcpu is not found, skip it and continue processing the remaining valid harts. Fixes: a046c2d8578c ("RISC-V: KVM: Reorganize SBI code by moving SBI v0.1 to its own file") Signed-off-by: Jiakai Xu <jiakaiPeanut@gmail.com> Signed-off-by: Jiakai Xu <xujiakai2025@iscas.ac.cn> Assisted-by: OpenClaw:DeepSeek-V3.2 Reviewed-by: Anup Patel <anup@brainfault.org> Link: https://lore.kernel.org/r/20260517124414.420919-1-xujiakai2025@iscas.ac.cn Signed-off-by: Anup Patel <anup@brainfault.org>
Diffstat (limited to 'include')
0 files changed, 0 insertions, 0 deletions