OSDN Git Service

pc: fix crash on attempted cpu unplug
authorIgor Mammedov <imammedo@redhat.com>
Mon, 20 Nov 2017 17:19:23 +0000 (18:19 +0100)
committerMichael S. Tsirkin <mst@redhat.com>
Fri, 1 Dec 2017 17:05:58 +0000 (19:05 +0200)
commit75ba2ddb188fa07c3442446766782036e3085cba
tree2179d5e3455ca2f2ab3eabc246173dfdb15d5d89
parent758ead31c7e17bf17a9ef2e0ca1c3e86ab296b43
pc: fix crash on attempted cpu unplug

when qemu is started with '-no-acpi' CLI option, an attempt
to unplug a CPU using device_del results in null pointer
dereference at:

  #0 object_get_class
  #1 pc_machine_device_unplug_request_cb
  #2 qmp_marshal_device_del

which is caused by pcms->acpi_dev == NULL due to ACPI support
being disabled.

Considering that ACPI support is necessary for unplug to work,
check that it's enabled and fail unplug request gracefully
if no acpi device were found.

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Eduardo Habkost <ehabkost@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
hw/i386/pc.c