KVM: x86: race between KVM_SET_GSI_ROUTING and KVM_CREATE_IRQCHIP
authorDavid Hildenbrand <david@redhat.com>
Fri, 7 Apr 2017 08:50:18 +0000 (10:50 +0200)
committerRadim Krčmář <rkrcmar@redhat.com>
Wed, 12 Apr 2017 18:17:13 +0000 (20:17 +0200)
commit1df6ddede10a1cacbf1da4cdfca3342510db1882
tree612eb2b179fbf29f5cff7c5542969646908bb3f8
parentf7b1a77d3bfbdc7e91a1e48e0a3dc10e7d890e04
KVM: x86: race between KVM_SET_GSI_ROUTING and KVM_CREATE_IRQCHIP

Avoid races between KVM_SET_GSI_ROUTING and KVM_CREATE_IRQCHIP by taking
the kvm->lock when setting up routes.

If KVM_CREATE_IRQCHIP fails, KVM_SET_GSI_ROUTING could have already set
up routes pointing at pic/ioapic, being silently removed already.

Also, as a side effect, this patch makes sure that KVM_SET_GSI_ROUTING
and KVM_CAP_SPLIT_IRQCHIP cannot run in parallel.

Signed-off-by: David Hildenbrand <david@redhat.com>
Signed-off-by: Radim Krčmář <rkrcmar@redhat.com>
virt/kvm/kvm_main.c