KVM: read apic->irr with ioapic lock held
authorMarcelo Tosatti <mtosatti@redhat.com>
Wed, 2 Jun 2010 14:26:26 +0000 (11:26 -0300)
committerAvi Kivity <avi@redhat.com>
Thu, 10 Jun 2010 17:29:03 +0000 (20:29 +0300)
Read ioapic->irr inside ioapic->lock protected section.

KVM-Stable-Tag
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
virt/kvm/ioapic.c

index 7c79c1d76d0c13e72463fcddc00cf845ad63ca87..3500dee9cf2b24e7a6965f67d198d6e290798f9e 100644 (file)
@@ -192,12 +192,13 @@ static int ioapic_deliver(struct kvm_ioapic *ioapic, int irq)
 
 int kvm_ioapic_set_irq(struct kvm_ioapic *ioapic, int irq, int level)
 {
-       u32 old_irr = ioapic->irr;
+       u32 old_irr;
        u32 mask = 1 << irq;
        union kvm_ioapic_redirect_entry entry;
        int ret = 1;
 
        spin_lock(&ioapic->lock);
+       old_irr = ioapic->irr;
        if (irq >= 0 && irq < IOAPIC_NUM_PINS) {
                entry = ioapic->redirtbl[irq];
                level ^= entry.fields.polarity;