[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 09/21] hw/acpi: Fix latent legacy CPU plug error handling bug
From: |
Markus Armbruster |
Subject: |
[PATCH 09/21] hw/acpi: Fix latent legacy CPU plug error handling bug |
Date: |
Sat, 30 Nov 2019 20:42:28 +0100 |
legacy_acpi_cpu_plug_cb() crashes when acpi_set_cpu_present_bit()
fails and its @errp argument is null. Messed up in commit cc43364de7
"acpi/cpu-hotplug: introduce helper function to keep bit setting in
one place".
The bug can't bite as no caller actually passes null, and
acpi_set_cpu_present_bit() can't actually fail. Fix it anyway.
Cc: "Michael S. Tsirkin" <address@hidden>
Cc: Igor Mammedov <address@hidden>
Signed-off-by: Markus Armbruster <address@hidden>
---
hw/acpi/cpu_hotplug.c | 10 +++-------
1 file changed, 3 insertions(+), 7 deletions(-)
diff --git a/hw/acpi/cpu_hotplug.c b/hw/acpi/cpu_hotplug.c
index 3ac2045a95..9c3bcc84de 100644
--- a/hw/acpi/cpu_hotplug.c
+++ b/hw/acpi/cpu_hotplug.c
@@ -55,8 +55,7 @@ static const MemoryRegionOps AcpiCpuHotplug_ops = {
},
};
-static void acpi_set_cpu_present_bit(AcpiCpuHotplug *g, CPUState *cpu,
- Error **errp)
+static void acpi_set_cpu_present_bit(AcpiCpuHotplug *g, CPUState *cpu)
{
CPUClass *k = CPU_GET_CLASS(cpu);
int64_t cpu_id;
@@ -74,10 +73,7 @@ static void acpi_set_cpu_present_bit(AcpiCpuHotplug *g,
CPUState *cpu,
void legacy_acpi_cpu_plug_cb(HotplugHandler *hotplug_dev,
AcpiCpuHotplug *g, DeviceState *dev, Error **errp)
{
- acpi_set_cpu_present_bit(g, CPU(dev), errp);
- if (*errp != NULL) {
- return;
- }
+ acpi_set_cpu_present_bit(g, CPU(dev));
acpi_send_event(DEVICE(hotplug_dev), ACPI_CPU_HOTPLUG_STATUS);
}
@@ -92,7 +88,7 @@ void legacy_acpi_cpu_hotplug_init(MemoryRegion *parent,
Object *owner,
gpe_cpu->device = owner;
CPU_FOREACH(cpu) {
- acpi_set_cpu_present_bit(gpe_cpu, cpu, &error_abort);
+ acpi_set_cpu_present_bit(gpe_cpu, cpu);
}
}
--
2.21.0
- [PATCH 06/21] io: Fix Error usage in a comment <example>, (continued)
- [PATCH 06/21] io: Fix Error usage in a comment <example>, Markus Armbruster, 2019/11/30
- [PATCH 16/21] s390/cpu_modules: Fix latent realize() error handling bugs, Markus Armbruster, 2019/11/30
- [PATCH 14/21] s390x/event-facility: Fix latent realize() error handling bug, Markus Armbruster, 2019/11/30
- [PATCH 10/21] hw/core: Fix latent fit_load_fdt() error handling bug, Markus Armbruster, 2019/11/30
- [PATCH 07/21] tests: Clean up initialization of Error *err variables, Markus Armbruster, 2019/11/30
- [PATCH 15/21] s390x/cpu_models: Fix latent feature property error handling bugs, Markus Armbruster, 2019/11/30
- [PATCH 13/21] memory-device: Fix latent memory pre-plug error handling bugs, Markus Armbruster, 2019/11/30
- [PATCH 12/21] qga: Fix latent guest-get-fsinfo error handling bug, Markus Armbruster, 2019/11/30
- [PATCH 18/21] s390x: Fix latent query-cpu-definitions error handling bug, Markus Armbruster, 2019/11/30
- [PATCH 11/21] hw/ipmi: Fix latent realize() error handling bugs, Markus Armbruster, 2019/11/30
- [PATCH 09/21] hw/acpi: Fix latent legacy CPU plug error handling bug,
Markus Armbruster <=
- [PATCH 21/21] tests-blockjob: Use error_free_or_abort(), Markus Armbruster, 2019/11/30
- [PATCH 20/21] hw/intc/s390: Simplify error handling in kvm_s390_flic_realize(), Markus Armbruster, 2019/11/30
- [PATCH 17/21] s390x: Fix latent query-cpu-model-FOO error handling bugs, Markus Armbruster, 2019/11/30