20220325132140.25650-3-vkuznets@xxxxxxxxxx> Message-ID: <1660568156124120@xxxxxxxxx> MIME-Version: 1.0 Content-Type: text/plain; charset=ANSI_X3.4-1968 Content-Transfer-Encoding: 8bit X-stable: commit X-Patchwork-Hint: ignore This is a note to let you know that I've just added the patch titled KVM: x86: Avoid theoretical NULL pointer dereference in kvm_irq_delivery_to_apic_fast() to the 4.19-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: kvm-x86-avoid-theoretical-null-pointer-dereference-in-kvm_irq_delivery_to_apic_fast.patch and it can be found in the queue-4.19 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From foo@baz Mon Aug 15 02:53:54 PM CEST 2022 From: Stefan Ghinea <stefan.ghinea@xxxxxxxxxxxxx> Date: Wed, 10 Aug 2022 23:26:24 +0300 Subject: KVM: x86: Avoid theoretical NULL pointer dereference in kvm_irq_delivery_to_apic_fast() To: stable@xxxxxxxxxxxxxxx Cc: Vitaly Kuznetsov <vkuznets@xxxxxxxxxx>, Paolo Bonzini <pbonzini@xxxxxxxxxx>, Stefan Ghinea <stefan.ghinea@xxxxxxxxxxxxx> Message-ID: <20220810202625.32529-3-stefan.ghinea@xxxxxxxxxxxxx> From: Vitaly Kuznetsov <vkuznets@xxxxxxxxxx> commit 00b5f37189d24ac3ed46cb7f11742094778c46ce upstream When kvm_irq_delivery_to_apic_fast() is called with APIC_DEST_SELF shorthand, 'src' must not be NULL. Crash the VM with KVM_BUG_ON() instead of crashing the host. Signed-off-by: Vitaly Kuznetsov <vkuznets@xxxxxxxxxx> Message-Id: <20220325132140.25650-3-vkuznets@xxxxxxxxxx> Cc: stable@xxxxxxxxxxxxxxx Signed-off-by: Paolo Bonzini <pbonzini@xxxxxxxxxx> Signed-off-by: Stefan Ghinea <stefan.ghinea@xxxxxxxxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- arch/x86/kvm/lapic.c | 4 ++++ 1 file changed, 4 insertions(+) --- a/arch/x86/kvm/lapic.c +++ b/arch/x86/kvm/lapic.c @@ -961,6 +961,10 @@ bool kvm_irq_delivery_to_apic_fast(struc *r = -1; if (irq->shorthand == APIC_DEST_SELF) { + if (KVM_BUG_ON(!src, kvm)) { + *r = 0; + return true; + } *r = kvm_apic_set_irq(src->vcpu, irq, dest_map); return true; } Patches currently in stable-queue which might be from stefan.ghinea@xxxxxxxxxxxxx are queue-4.19/kvm-x86-avoid-theoretical-null-pointer-dereference-in-kvm_irq_delivery_to_apic_fast.patch queue-4.19/kvm-x86-check-lapic_in_kernel-before-attempting-to-set-a-synic-irq.patch queue-4.19/kvm-add-infrastructure-and-macro-to-mark-vm-as-bugged.patch