summaryrefslogtreecommitdiffstats
path: root/virt
diff options
context:
space:
mode:
authorMarc Zyngier2018-12-04 18:11:19 +0100
committerMarc Zyngier2018-12-18 16:14:50 +0100
commitbea2ef803ade3359026d5d357348842bca9edcf1 (patch)
tree3d3f92151225bcbc4bc1d5c4805541d1880f9ea5 /virt
parentKVM: arm64: Clarify explanation of STAGE2_PGTABLE_LEVELS (diff)
downloadkernel-qcow2-linux-bea2ef803ade3359026d5d357348842bca9edcf1.tar.gz
kernel-qcow2-linux-bea2ef803ade3359026d5d357348842bca9edcf1.tar.xz
kernel-qcow2-linux-bea2ef803ade3359026d5d357348842bca9edcf1.zip
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>
Diffstat (limited to 'virt')
-rw-r--r--virt/kvm/arm/vgic/vgic.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/virt/kvm/arm/vgic/vgic.c b/virt/kvm/arm/vgic/vgic.c
index 7cfdfbc910e0..8ab0491bcc94 100644
--- a/virt/kvm/arm/vgic/vgic.c
+++ b/virt/kvm/arm/vgic/vgic.c
@@ -108,8 +108,8 @@ struct vgic_irq *vgic_get_irq(struct kvm *kvm, struct kvm_vcpu *vcpu,
}
/* SPIs */
- if (intid <= VGIC_MAX_SPI) {
- intid = array_index_nospec(intid, VGIC_MAX_SPI);
+ if (intid < (kvm->arch.vgic.nr_spis + VGIC_NR_PRIVATE_IRQS)) {
+ intid = array_index_nospec(intid, kvm->arch.vgic.nr_spis + VGIC_NR_PRIVATE_IRQS);
return &kvm->arch.vgic.spis[intid - VGIC_NR_PRIVATE_IRQS];
}