• Nitesh Narayan Lal's avatar
    KVM: x86: Initializing all kvm_lapic_irq fields in ioapic_write_indirect · 0c22056f
    Nitesh Narayan Lal authored
    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: 7ee30bc1 ("KVM: x86: deliver KVM IOAPIC scan request to target vCPUs")
    Signed-off-by: default avatarNitesh Narayan Lal <nitesh@redhat.com>
    Reviewed-by: default avatarVitaly Kuznetsov <vkuznets@redhat.com>
    [Set level to false since the value doesn't really matter. Suggested
     by Vitaly Kuznetsov. - Paolo]
    Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
    0c22056f
ioapic.c 19.6 KB