Blame SOURCES/kvm-pc-fix-crash-on-attempted-cpu-unplug.patch

4a2fec
From f8394b69cee118293a1983ebc99492f113d57704 Mon Sep 17 00:00:00 2001
4a2fec
From: Igor Mammedov <imammedo@redhat.com>
4a2fec
Date: Wed, 6 Dec 2017 13:47:58 +0100
4a2fec
Subject: [PATCH 20/21] pc: fix crash on attempted cpu unplug
4a2fec
4a2fec
RH-Author: Igor Mammedov <imammedo@redhat.com>
4a2fec
Message-id: <1512568078-280557-1-git-send-email-imammedo@redhat.com>
4a2fec
Patchwork-id: 78212
4a2fec
O-Subject: [RHEL7.5 qemu-kvm-rhev PATCH] pc: fix crash on attempted cpu unplug
4a2fec
Bugzilla: 1506856
4a2fec
RH-Acked-by: Laurent Vivier <lvivier@redhat.com>
4a2fec
RH-Acked-by: Marcel Apfelbaum <marcel@redhat.com>
4a2fec
RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
4a2fec
4a2fec
when qemu is started with '-no-acpi' CLI option, an attempt
4a2fec
to unplug a CPU using device_del results in null pointer
4a2fec
dereference at:
4a2fec
4a2fec
  #0 object_get_class
4a2fec
  #1 pc_machine_device_unplug_request_cb
4a2fec
  #2 qmp_marshal_device_del
4a2fec
4a2fec
which is caused by pcms->acpi_dev == NULL due to ACPI support
4a2fec
being disabled.
4a2fec
4a2fec
Considering that ACPI support is necessary for unplug to work,
4a2fec
check that it's enabled and fail unplug request gracefully
4a2fec
if no acpi device were found.
4a2fec
4a2fec
Signed-off-by: Igor Mammedov <imammedo@redhat.com>
4a2fec
Reviewed-by: Eduardo Habkost <ehabkost@redhat.com>
4a2fec
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
4a2fec
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
4a2fec
(cherry picked from commit 75ba2ddb188fa07c3442446766782036e3085cba)
4a2fec
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
4a2fec
---
4a2fec
 hw/i386/pc.c | 5 +++++
4a2fec
 1 file changed, 5 insertions(+)
4a2fec
4a2fec
diff --git a/hw/i386/pc.c b/hw/i386/pc.c
4a2fec
index f37d60a..db57b51 100644
4a2fec
--- a/hw/i386/pc.c
4a2fec
+++ b/hw/i386/pc.c
4a2fec
@@ -1879,6 +1879,11 @@ static void pc_cpu_unplug_request_cb(HotplugHandler *hotplug_dev,
4a2fec
     X86CPU *cpu = X86_CPU(dev);
4a2fec
     PCMachineState *pcms = PC_MACHINE(hotplug_dev);
4a2fec
 
4a2fec
+    if (!pcms->acpi_dev) {
4a2fec
+        error_setg(&local_err, "CPU hot unplug not supported without ACPI");
4a2fec
+        goto out;
4a2fec
+    }
4a2fec
+
4a2fec
     pc_find_cpu_slot(MACHINE(pcms), cpu->apic_id, &idx);
4a2fec
     assert(idx != -1);
4a2fec
     if (idx == 0) {
4a2fec
-- 
4a2fec
1.8.3.1
4a2fec