summary refs log tree commit diff stats
path: root/hw/acpi/vmgenid.c
diff options
context:
space:
mode:
authorLaszlo Ersek <lersek@redhat.com>2017-03-20 18:05:57 +0100
committerMichael S. Tsirkin <mst@redhat.com>2017-03-22 18:29:27 +0200
commitf92063028a0ea9e15d8f962644bce76c0e8aa7d1 (patch)
treeaa6351da0d31306379373403493ee34065c05391 /hw/acpi/vmgenid.c
parentf2a1ae45d8ec5ad494e66a9234499a2e0fbf4b40 (diff)
downloadfocaccia-qemu-f92063028a0ea9e15d8f962644bce76c0e8aa7d1.tar.gz
focaccia-qemu-f92063028a0ea9e15d8f962644bce76c0e8aa7d1.zip
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" <mst@redhat.com>
Cc: Ben Warren <ben@skyportsystems.com>
Cc: Igor Mammedov <imammedo@redhat.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Diffstat (limited to 'hw/acpi/vmgenid.c')
-rw-r--r--hw/acpi/vmgenid.c8
1 files changed, 8 insertions, 0 deletions
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);
 }