thebeanogamer / rpms / qemu-kvm

Forked from rpms/qemu-kvm 5 months ago
Clone
9ae3a8
From 041c25ce0ca658d4426ec18a116a464e4bac9862 Mon Sep 17 00:00:00 2001
9ae3a8
From: Marcel Apfelbaum <marcel.a@redhat.com>
9ae3a8
Date: Thu, 20 Nov 2014 10:33:13 +0100
9ae3a8
Subject: [PATCH 1/2] hw/pci: fixed error flow in pci_qdev_init
9ae3a8
9ae3a8
Message-id: <1416479594-22022-2-git-send-email-marcel.a@redhat.com>
9ae3a8
Patchwork-id: 62484
9ae3a8
O-Subject: [RHEL-7.1 qemu-kvm PATCH 1/2] hw/pci: fixed error flow in pci_qdev_init
9ae3a8
Bugzilla: 1046007
9ae3a8
RH-Acked-by: Dr. David Alan Gilbert (git) <dgilbert@redhat.com>
9ae3a8
RH-Acked-by: Amos Kong <akong@redhat.com>
9ae3a8
RH-Acked-by: Eric Blake <eblake@redhat.com>
9ae3a8
RH-Acked-by: Markus Armbruster <armbru@redhat.com>
9ae3a8
9ae3a8
Verify return code for pci_add_option_rom.
9ae3a8
9ae3a8
Signed-off-by: Marcel Apfelbaum <marcel.a@redhat.com>
9ae3a8
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
9ae3a8
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
9ae3a8
Reviewed-by: Markus Armbruster <armbru@redhat.com>
9ae3a8
(cherry picked from commit 178e785fb4507ec3462dc772bbe08303416ece47)
9ae3a8
Signed-off-by: Marcel Apfelbaum <marcel.a@redhat.com>
9ae3a8
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
9ae3a8
---
9ae3a8
 hw/pci/pci.c | 7 ++++++-
9ae3a8
 1 file changed, 6 insertions(+), 1 deletion(-)
9ae3a8
9ae3a8
diff --git a/hw/pci/pci.c b/hw/pci/pci.c
9ae3a8
index 703b111..0918f4e 100644
9ae3a8
--- a/hw/pci/pci.c
9ae3a8
+++ b/hw/pci/pci.c
9ae3a8
@@ -1733,7 +1733,12 @@ static int pci_qdev_init(DeviceState *qdev)
9ae3a8
         pci_dev->romfile = g_strdup(pc->romfile);
9ae3a8
         is_default_rom = true;
9ae3a8
     }
9ae3a8
-    pci_add_option_rom(pci_dev, is_default_rom);
9ae3a8
+
9ae3a8
+    rc = pci_add_option_rom(pci_dev, is_default_rom);
9ae3a8
+    if (rc != 0) {
9ae3a8
+        pci_unregister_device(DEVICE(pci_dev));
9ae3a8
+        return rc;
9ae3a8
+    }
9ae3a8
 
9ae3a8
     if (bus->hotplug) {
9ae3a8
         /* Let buses differentiate between hotplug and when device is
9ae3a8
-- 
9ae3a8
1.8.3.1
9ae3a8