Skip to content
This repository was archived by the owner on Dec 25, 2023. It is now read-only.

Commit 91017f1

Browse files
Marc Zyngiergregkh
Marc Zyngier
authored andcommitted
KVM: arm: vgic: Fix limit condition when writing to GICD_I[CS]ACTIVER
commit 1c32ca5dc6d00012f0c964e5fdd7042fcc71efb1 upstream. When deciding whether a guest has to be stopped we check whether this is a private interrupt or not. Unfortunately, there's an off-by-one bug here, and we fail to recognize a whole range of interrupts as being global (GICv2 SPIs 32-63). Fix the condition from > to be >=. Cc: [email protected] Fixes: abd7229 ("KVM: arm/arm64: Simplify active_change_prepare and plug race") Reported-by: André Przywara <[email protected]> Signed-off-by: Marc Zyngier <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 4d9c4f4 commit 91017f1

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

virt/kvm/arm/vgic/vgic-mmio.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -260,15 +260,15 @@ static void vgic_mmio_change_active(struct kvm_vcpu *vcpu, struct vgic_irq *irq,
260260
static void vgic_change_active_prepare(struct kvm_vcpu *vcpu, u32 intid)
261261
{
262262
if (vcpu->kvm->arch.vgic.vgic_model == KVM_DEV_TYPE_ARM_VGIC_V3 ||
263-
intid > VGIC_NR_PRIVATE_IRQS)
263+
intid >= VGIC_NR_PRIVATE_IRQS)
264264
kvm_arm_halt_guest(vcpu->kvm);
265265
}
266266

267267
/* See vgic_change_active_prepare */
268268
static void vgic_change_active_finish(struct kvm_vcpu *vcpu, u32 intid)
269269
{
270270
if (vcpu->kvm->arch.vgic.vgic_model == KVM_DEV_TYPE_ARM_VGIC_V3 ||
271-
intid > VGIC_NR_PRIVATE_IRQS)
271+
intid >= VGIC_NR_PRIVATE_IRQS)
272272
kvm_arm_resume_guest(vcpu->kvm);
273273
}
274274

0 commit comments

Comments
 (0)