aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndre Przywara <andre.przywara@arm.com>2017-11-17 12:58:21 -0500
committerChristoffer Dall <christoffer.dall@linaro.org>2017-11-29 10:46:10 -0500
commit285a90e36b138b707c4a9850f2500774b7191c99 (patch)
tree6c230122f28c33255833360966915a254f2c4828
parentec6449a9c2296b1c04f6219f7473e0c2fedecfed (diff)
KVM: arm/arm64: VGIC: extend !vgic_is_initialized guard
Commit f39d16cbabf9 ("KVM: arm/arm64: Guard kvm_vgic_map_is_active against !vgic_initialized") introduced a check whether the VGIC has been initialized before accessing the spinlock and the VGIC data structure. However the vgic_get_irq() call in the variable declaration sneaked through the net, so lets make sure that this also gets called only after we actually allocated the arrays this function accesses. Reviewed-by: Eric Auger <eric.auger@redhat.com> Signed-off-by: Andre Przywara <andre.przywara@arm.com> Signed-off-by: Christoffer Dall <christoffer.dall@linaro.org>
-rw-r--r--virt/kvm/arm/vgic/vgic.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/virt/kvm/arm/vgic/vgic.c b/virt/kvm/arm/vgic/vgic.c
index b168a328a9e0..786cce7bd2ec 100644
--- a/virt/kvm/arm/vgic/vgic.c
+++ b/virt/kvm/arm/vgic/vgic.c
@@ -823,13 +823,14 @@ void vgic_kick_vcpus(struct kvm *kvm)
823 823
824bool kvm_vgic_map_is_active(struct kvm_vcpu *vcpu, unsigned int vintid) 824bool kvm_vgic_map_is_active(struct kvm_vcpu *vcpu, unsigned int vintid)
825{ 825{
826 struct vgic_irq *irq = vgic_get_irq(vcpu->kvm, vcpu, vintid); 826 struct vgic_irq *irq;
827 bool map_is_active; 827 bool map_is_active;
828 unsigned long flags; 828 unsigned long flags;
829 829
830 if (!vgic_initialized(vcpu->kvm)) 830 if (!vgic_initialized(vcpu->kvm))
831 return false; 831 return false;
832 832
833 irq = vgic_get_irq(vcpu->kvm, vcpu, vintid);
833 spin_lock_irqsave(&irq->irq_lock, flags); 834 spin_lock_irqsave(&irq->irq_lock, flags);
834 map_is_active = irq->hw && irq->active; 835 map_is_active = irq->hw && irq->active;
835 spin_unlock_irqrestore(&irq->irq_lock, flags); 836 spin_unlock_irqrestore(&irq->irq_lock, flags);