Commit 07dc7263b99e4ddad2b4c69765a428ccb7d48938

Authored by Marcelo Tosatti
Committed by Avi Kivity
1 parent 3499f4d0d1

KVM: read apic->irr with ioapic lock held

Read ioapic->irr inside ioapic->lock protected section.

KVM-Stable-Tag
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>

Showing 1 changed file with 2 additions and 1 deletions Side-by-side Diff

... ... @@ -192,12 +192,13 @@
192 192  
193 193 int kvm_ioapic_set_irq(struct kvm_ioapic *ioapic, int irq, int level)
194 194 {
195   - u32 old_irr = ioapic->irr;
  195 + u32 old_irr;
196 196 u32 mask = 1 << irq;
197 197 union kvm_ioapic_redirect_entry entry;
198 198 int ret = 1;
199 199  
200 200 spin_lock(&ioapic->lock);
  201 + old_irr = ioapic->irr;
201 202 if (irq >= 0 && irq < IOAPIC_NUM_PINS) {
202 203 entry = ioapic->redirtbl[irq];
203 204 level ^= entry.fields.polarity;