KVM: x86: Initializing all kvm_lapic_irq fields in ioapic_write_indirect
authorNitesh Narayan Lal <nitesh@redhat.com>
Fri, 13 Mar 2020 13:16:24 +0000 (09:16 -0400)
committerPaolo Bonzini <pbonzini@redhat.com>
Sat, 14 Mar 2020 09:46:01 +0000 (10:46 +0100)
commit0c22056f8c43265da21a3dfe7b7e1379e5ff7c72
tree7a75e7ca42aebf30f85a19b33355daec2301c2a6
parent7a57c09bb1cb89239f38f690b87cdf2c7db76c34
KVM: x86: Initializing all kvm_lapic_irq fields in ioapic_write_indirect

Previously all fields of structure kvm_lapic_irq were not initialized
before it was passed to kvm_bitmap_or_dest_vcpus(). Which will cause
an issue when any of those fields are used for processing a request.
For example not initializing the msi_redir_hint field before passing
to the kvm_bitmap_or_dest_vcpus(), may lead to a misbehavior of
kvm_apic_map_get_dest_lapic(). This will specifically happen when the
kvm_lowest_prio_delivery() returns TRUE due to a non-zero garbage
value of msi_redir_hint, which should not happen as the request belongs
to APIC fixed delivery mode and we do not want to deliver the
interrupt only to the lowest priority candidate.

This patch initializes all the fields of kvm_lapic_irq based on the
values of ioapic redirect_entry object before passing it on to
kvm_bitmap_or_dest_vcpus().

Fixes: 7ee30bc132c6 ("KVM: x86: deliver KVM IOAPIC scan request to target vCPUs")
Signed-off-by: Nitesh Narayan Lal <nitesh@redhat.com>
Reviewed-by: Vitaly Kuznetsov <vkuznets@redhat.com>
[Set level to false since the value doesn't really matter. Suggested
 by Vitaly Kuznetsov. - Paolo]
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/x86/kvm/ioapic.c