Skip to content

Commit bea2ef8

Browse files
author
Marc Zyngier
committed
KVM: arm/arm64: vgic: Cap SPIs to the VM-defined maximum
SPIs should be checked against the VMs specific configuration, and not the architectural maximum. Cc: stable@vger.kernel.org Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
1 parent 6992195 commit bea2ef8

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

‎virt/kvm/arm/vgic/vgic.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,8 +108,8 @@ struct vgic_irq *vgic_get_irq(struct kvm *kvm, struct kvm_vcpu *vcpu,
108108
}
109109

110110
/* SPIs */
111-
if (intid <= VGIC_MAX_SPI) {
112-
intid = array_index_nospec(intid, VGIC_MAX_SPI);
111+
if (intid < (kvm->arch.vgic.nr_spis + VGIC_NR_PRIVATE_IRQS)) {
112+
intid = array_index_nospec(intid, kvm->arch.vgic.nr_spis + VGIC_NR_PRIVATE_IRQS);
113113
return &kvm->arch.vgic.spis[intid - VGIC_NR_PRIVATE_IRQS];
114114
}
115115

0 commit comments

Comments
 (0)