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

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