Skip to content

[PW_SID:1096052] [v2] RISC-V: KVM: Fix NULL pointer dereference in SBI v0.1 SEND_IPI handler#1954

Open
linux-riscv-bot wants to merge 1 commit into
workflow__riscv__fixesfrom
pw1096052
Open

[PW_SID:1096052] [v2] RISC-V: KVM: Fix NULL pointer dereference in SBI v0.1 SEND_IPI handler#1954
linux-riscv-bot wants to merge 1 commit into
workflow__riscv__fixesfrom
pw1096052

Conversation

@linux-riscv-bot
Copy link
Copy Markdown

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

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>
@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "[v2] RISC-V: KVM: Fix NULL pointer dereference in SBI v0.1 SEND_IPI handler"
build-rv32-defconfig
Desc: Builds riscv32 defconfig
Duration: 140.85 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "[v2] RISC-V: KVM: Fix NULL pointer dereference in SBI v0.1 SEND_IPI handler"
build-rv64-clang-allmodconfig
Desc: Builds riscv64 allmodconfig with Clang, and checks for errors and added warnings
Duration: 1045.45 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "[v2] RISC-V: KVM: Fix NULL pointer dereference in SBI v0.1 SEND_IPI handler"
build-rv64-gcc-allmodconfig
Desc: Builds riscv64 allmodconfig with GCC, and checks for errors and added warnings
Duration: 1423.46 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "[v2] RISC-V: KVM: Fix NULL pointer dereference in SBI v0.1 SEND_IPI handler"
build-rv64-nommu-k210-defconfig
Desc: Builds riscv64 defconfig with NOMMU for K210
Duration: 26.00 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "[v2] RISC-V: KVM: Fix NULL pointer dereference in SBI v0.1 SEND_IPI handler"
build-rv64-nommu-k210-virt
Desc: Builds riscv64 defconfig with NOMMU for the virt platform
Duration: 27.38 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "[v2] RISC-V: KVM: Fix NULL pointer dereference in SBI v0.1 SEND_IPI handler"
checkpatch
Desc: Runs checkpatch.pl on the patch
Duration: 0.80 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "[v2] RISC-V: KVM: Fix NULL pointer dereference in SBI v0.1 SEND_IPI handler"
dtb-warn-rv64
Desc: Checks for Device Tree warnings/errors
Duration: 87.85 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "[v2] RISC-V: KVM: Fix NULL pointer dereference in SBI v0.1 SEND_IPI handler"
header-inline
Desc: Detects static functions without inline keyword in header files
Duration: 0.25 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "[v2] RISC-V: KVM: Fix NULL pointer dereference in SBI v0.1 SEND_IPI handler"
kdoc
Desc: Detects for kdoc errors
Duration: 0.86 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "[v2] RISC-V: KVM: Fix NULL pointer dereference in SBI v0.1 SEND_IPI handler"
module-param
Desc: Detect module_param changes
Duration: 0.26 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "[v2] RISC-V: KVM: Fix NULL pointer dereference in SBI v0.1 SEND_IPI handler"
verify-fixes
Desc: Verifies that the Fixes: tags exist
Duration: 0.28 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "[v2] RISC-V: KVM: Fix NULL pointer dereference in SBI v0.1 SEND_IPI handler"
verify-signedoff
Desc: Verifies that Signed-off-by: tags are correct
Duration: 0.30 seconds
Result: PASS

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants