diff options
author | Marc Zyngier <marc.zyngier@arm.com> | 2018-12-04 17:11:19 +0000 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2019-01-09 17:38:49 +0100 |
commit | 6318b1b7c90cf60e2a64918734201edcc0e22b3e (patch) | |
tree | fc73f373719ab320558e018fdd02b0260b912738 /virt | |
parent | f0fcc4d17cf46911c9609e1fc5af518864f96220 (diff) | |
download | linux-rpi3-6318b1b7c90cf60e2a64918734201edcc0e22b3e.tar.gz linux-rpi3-6318b1b7c90cf60e2a64918734201edcc0e22b3e.tar.bz2 linux-rpi3-6318b1b7c90cf60e2a64918734201edcc0e22b3e.zip |
KVM: arm/arm64: vgic: Cap SPIs to the VM-defined maximum
commit bea2ef803ade3359026d5d357348842bca9edcf1 upstream.
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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'virt')
-rw-r--r-- | virt/kvm/arm/vgic/vgic.c | 4 |
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]; } |