mirror of
https://github.com/adulau/aha.git
synced 2024-12-28 03:36:19 +00:00
KVM: only clear irq_source_id if irqchip is present
Otherwise kvm might attempt to dereference a NULL pointer. Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com> Signed-off-by: Avi Kivity <avi@redhat.com>
This commit is contained in:
parent
2204ae3c96
commit
e50212bb51
1 changed files with 4 additions and 1 deletions
|
@ -243,6 +243,10 @@ void kvm_free_irq_source_id(struct kvm *kvm, int irq_source_id)
|
||||||
printk(KERN_ERR "kvm: IRQ source ID out of range!\n");
|
printk(KERN_ERR "kvm: IRQ source ID out of range!\n");
|
||||||
goto unlock;
|
goto unlock;
|
||||||
}
|
}
|
||||||
|
clear_bit(irq_source_id, &kvm->arch.irq_sources_bitmap);
|
||||||
|
if (!irqchip_in_kernel(kvm))
|
||||||
|
goto unlock;
|
||||||
|
|
||||||
for (i = 0; i < KVM_IOAPIC_NUM_PINS; i++) {
|
for (i = 0; i < KVM_IOAPIC_NUM_PINS; i++) {
|
||||||
clear_bit(irq_source_id, &kvm->arch.vioapic->irq_states[i]);
|
clear_bit(irq_source_id, &kvm->arch.vioapic->irq_states[i]);
|
||||||
if (i >= 16)
|
if (i >= 16)
|
||||||
|
@ -251,7 +255,6 @@ void kvm_free_irq_source_id(struct kvm *kvm, int irq_source_id)
|
||||||
clear_bit(irq_source_id, &pic_irqchip(kvm)->irq_states[i]);
|
clear_bit(irq_source_id, &pic_irqchip(kvm)->irq_states[i]);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
clear_bit(irq_source_id, &kvm->arch.irq_sources_bitmap);
|
|
||||||
unlock:
|
unlock:
|
||||||
mutex_unlock(&kvm->irq_lock);
|
mutex_unlock(&kvm->irq_lock);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue