Skip to content

Commit

Permalink
KVM: arm/arm64: VGIC: extend !vgic_is_initialized guard
Browse files Browse the repository at this point in the history
Commit f39d16c ("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 <[email protected]>
Signed-off-by: Andre Przywara <[email protected]>
Signed-off-by: Christoffer Dall <[email protected]>
  • Loading branch information
Andre-ARM authored and chazy committed Nov 29, 2017
1 parent ec6449a commit 285a90e
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion virt/kvm/arm/vgic/vgic.c
Original file line number Diff line number Diff line change
Expand Up @@ -823,13 +823,14 @@ void vgic_kick_vcpus(struct kvm *kvm)

bool kvm_vgic_map_is_active(struct kvm_vcpu *vcpu, unsigned int vintid)
{
struct vgic_irq *irq = vgic_get_irq(vcpu->kvm, vcpu, vintid);
struct vgic_irq *irq;
bool map_is_active;
unsigned long flags;

if (!vgic_initialized(vcpu->kvm))
return false;

irq = vgic_get_irq(vcpu->kvm, vcpu, vintid);
spin_lock_irqsave(&irq->irq_lock, flags);
map_is_active = irq->hw && irq->active;
spin_unlock_irqrestore(&irq->irq_lock, flags);
Expand Down

0 comments on commit 285a90e

Please sign in to comment.