[PATCH] RISC-V: KVM: Fix NULL pointer dereference in SBI v0.1 SEND_IPI handler

Jiakai Xu xujiakai2025 at iscas.ac.cn
Sun May 17 05:38:59 PDT 2026


Hi, Anup!

Thanks for your review!

> > diff --git a/arch/riscv/kvm/vcpu_sbi_v01.c b/arch/riscv/kvm/vcpu_sbi_v01.c
> > index 188d5ea5b3b85..98ecfcb2469e6 100644
> > --- a/arch/riscv/kvm/vcpu_sbi_v01.c
> > +++ b/arch/riscv/kvm/vcpu_sbi_v01.c
> > @@ -55,6 +55,8 @@ static int kvm_sbi_ext_v01_handler(struct kvm_vcpu *vcpu, struct kvm_run *run,
> >
> >                 for_each_set_bit(i, &hmask, BITS_PER_LONG) {
> >                         rvcpu = kvm_get_vcpu_by_id(vcpu->kvm, i);
> > +                       if (!rvcpu)
> > +                               break;
> 
> Instead of break it is better to continue here so that non-existent
> VCPUs are ignored.

You are right. I'll send the v2 patch later.

Jiakai




More information about the linux-riscv mailing list