]>
Commit | Line | Data |
---|---|---|
44967d01 GKH |
1 | From bea2ef803ade3359026d5d357348842bca9edcf1 Mon Sep 17 00:00:00 2001 |
2 | From: Marc Zyngier <marc.zyngier@arm.com> | |
3 | Date: Tue, 4 Dec 2018 17:11:19 +0000 | |
4 | Subject: KVM: arm/arm64: vgic: Cap SPIs to the VM-defined maximum | |
5 | ||
6 | From: Marc Zyngier <marc.zyngier@arm.com> | |
7 | ||
8 | commit bea2ef803ade3359026d5d357348842bca9edcf1 upstream. | |
9 | ||
10 | SPIs should be checked against the VMs specific configuration, and | |
11 | not the architectural maximum. | |
12 | ||
13 | Cc: stable@vger.kernel.org | |
14 | Signed-off-by: Marc Zyngier <marc.zyngier@arm.com> | |
15 | Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> | |
16 | ||
17 | --- | |
18 | virt/kvm/arm/vgic/vgic.c | 4 ++-- | |
19 | 1 file changed, 2 insertions(+), 2 deletions(-) | |
20 | ||
21 | --- a/virt/kvm/arm/vgic/vgic.c | |
22 | +++ b/virt/kvm/arm/vgic/vgic.c | |
23 | @@ -108,8 +108,8 @@ struct vgic_irq *vgic_get_irq(struct kvm | |
24 | } | |
25 | ||
26 | /* SPIs */ | |
27 | - if (intid <= VGIC_MAX_SPI) { | |
28 | - intid = array_index_nospec(intid, VGIC_MAX_SPI); | |
29 | + if (intid < (kvm->arch.vgic.nr_spis + VGIC_NR_PRIVATE_IRQS)) { | |
30 | + intid = array_index_nospec(intid, kvm->arch.vgic.nr_spis + VGIC_NR_PRIVATE_IRQS); | |
31 | return &kvm->arch.vgic.spis[intid - VGIC_NR_PRIVATE_IRQS]; | |
32 | } | |
33 |