KVM: x86: prevent setup of invalid routes
authorRadim Krčmář <rkrcmar@redhat.com>
Fri, 16 Dec 2016 15:10:05 +0000 (16:10 +0100)
committerRadim Krčmář <rkrcmar@redhat.com>
Mon, 9 Jan 2017 13:45:50 +0000 (14:45 +0100)
commit8231f50d9853274ed104aac86b6b6263ca666c4d
tree5d9a37472616e7a789505ecec1cd1458c7c2c5a0
parente5dc48777dcc898210e2f16d80d44718db38cdc3
KVM: x86: prevent setup of invalid routes

The check in kvm_set_pic_irq() and kvm_set_ioapic_irq() was just a
temporary measure until the code improved enough for us to do this.

This changes APIC in a case when KVM_SET_GSI_ROUTING is called to set up pic
and ioapic routes before KVM_CREATE_IRQCHIP.  Those rules would get overwritten
by KVM_CREATE_IRQCHIP at best, so it is pointless to allow it.  Userspaces
hopefully noticed that things don't work if they do that and don't do that.

Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: David Hildenbrand <david@redhat.com>
Signed-off-by: Radim Krčmář <rkrcmar@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/x86/kvm/irq_comm.c