From f92063028a0ea9e15d8f962644bce76c0e8aa7d1 Mon Sep 17 00:00:00 2001 From: Laszlo Ersek Date: Mon, 20 Mar 2017 18:05:57 +0100 Subject: hw/acpi/vmgenid: prevent more than one vmgenid device A system with multiple VMGENID devices is undefined in the VMGENID spec by omission. Cc: "Michael S. Tsirkin" Cc: Ben Warren Cc: Igor Mammedov Cc: Paolo Bonzini Signed-off-by: Laszlo Ersek Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin Reviewed-by: Igor Mammedov --- hw/acpi/vmgenid.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'hw/acpi') diff --git a/hw/acpi/vmgenid.c b/hw/acpi/vmgenid.c index c3ddcc8e7c..a32b847fe0 100644 --- a/hw/acpi/vmgenid.c +++ b/hw/acpi/vmgenid.c @@ -221,6 +221,14 @@ static void vmgenid_realize(DeviceState *dev, Error **errp) return; } + /* Given that this function is executing, there is at least one VMGENID + * device. Check if there are several. + */ + if (!find_vmgenid_dev()) { + error_setg(errp, "at most one %s device is permitted", VMGENID_DEVICE); + return; + } + qemu_register_reset(vmgenid_handle_reset, vms); } -- cgit v1.2.1