@@ -951,7 +951,9 @@ long kvm_arch_vm_ioctl(struct file *filp,
mutex_unlock(&kvm->slots_lock);
if (r)
goto out;
+ mutex_lock(&kvm->irq_lock);
r = kvm_setup_default_irq_routing(kvm);
+ mutex_unlock(&kvm->irq_lock);
if (r) {
mutex_lock(&kvm->slots_lock);
kvm_ioapic_destroy(kvm);
@@ -3319,13 +3319,13 @@ long kvm_arch_vm_ioctl(struct file *filp,
smp_wmb();
kvm->arch.vpic = vpic;
smp_wmb();
+ mutex_lock(&kvm->irq_lock);
r = kvm_setup_default_irq_routing(kvm);
if (r) {
- mutex_lock(&kvm->irq_lock);
kvm_ioapic_destroy(kvm);
kvm_destroy_pic(kvm);
- mutex_unlock(&kvm->irq_lock);
}
+ mutex_unlock(&kvm->irq_lock);
create_irqchip_unlock:
mutex_unlock(&kvm->slots_lock);
mutex_unlock(&kvm->lock);
@@ -407,10 +407,8 @@ int kvm_set_irq_routing(struct kvm *kvm,
++ue;
}
- mutex_lock(&kvm->irq_lock);
old = kvm->irq_routing;
kvm_irq_routing_update(kvm, new);
- mutex_unlock(&kvm->irq_lock);
synchronize_rcu();