[PW_SID:1096052] [v2] RISC-V: KVM: Fix NULL pointer dereference in SBI v0.1 SEND_IPI handler#1954
[PW_SID:1096052] [v2] RISC-V: KVM: Fix NULL pointer dereference in SBI v0.1 SEND_IPI handler#1954linux-riscv-bot wants to merge 1 commit into
Conversation
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: a046c2d ("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 Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
|
Patch 1: "[v2] RISC-V: KVM: Fix NULL pointer dereference in SBI v0.1 SEND_IPI handler" |
|
Patch 1: "[v2] RISC-V: KVM: Fix NULL pointer dereference in SBI v0.1 SEND_IPI handler" |
|
Patch 1: "[v2] RISC-V: KVM: Fix NULL pointer dereference in SBI v0.1 SEND_IPI handler" |
|
Patch 1: "[v2] RISC-V: KVM: Fix NULL pointer dereference in SBI v0.1 SEND_IPI handler" |
|
Patch 1: "[v2] RISC-V: KVM: Fix NULL pointer dereference in SBI v0.1 SEND_IPI handler" |
|
Patch 1: "[v2] RISC-V: KVM: Fix NULL pointer dereference in SBI v0.1 SEND_IPI handler" |
|
Patch 1: "[v2] RISC-V: KVM: Fix NULL pointer dereference in SBI v0.1 SEND_IPI handler" |
|
Patch 1: "[v2] RISC-V: KVM: Fix NULL pointer dereference in SBI v0.1 SEND_IPI handler" |
|
Patch 1: "[v2] RISC-V: KVM: Fix NULL pointer dereference in SBI v0.1 SEND_IPI handler" |
|
Patch 1: "[v2] RISC-V: KVM: Fix NULL pointer dereference in SBI v0.1 SEND_IPI handler" |
|
Patch 1: "[v2] RISC-V: KVM: Fix NULL pointer dereference in SBI v0.1 SEND_IPI handler" |
|
Patch 1: "[v2] RISC-V: KVM: Fix NULL pointer dereference in SBI v0.1 SEND_IPI handler" |
PR for series 1096052 applied to workflow__riscv__fixes
Name: [v2] RISC-V: KVM: Fix NULL pointer dereference in SBI v0.1 SEND_IPI handler
URL: https://patchwork.kernel.org/project/linux-riscv/list/?series=1096052
Version: 2