Skip to content
Commit 332fa4a8 authored by Björn Töpel's avatar Björn Töpel Committed by Anup Patel
Browse files

riscv: kvm: Fix out-of-bounds array access



In kvm_riscv_vcpu_sbi_init() the entry->ext_idx can contain an
out-of-bound index. This is used as a special marker for the base
extensions, that cannot be disabled. However, when traversing the
extensions, that special marker is not checked prior indexing the
array.

Add an out-of-bounds check to the function.

Fixes: 56d8a385 ("RISC-V: KVM: Allow some SBI extensions to be disabled by default")
Signed-off-by: default avatarBjörn Töpel <bjorn@rivosinc.com>
Reviewed-by: default avatarAnup Patel <anup@brainfault.org>
Link: https://lore.kernel.org/r/20241104191503.74725-1-bjorn@kernel.org


Signed-off-by: default avatarAnup Patel <anup@brainfault.org>
parent 60821fb4
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment