Blame SOURCES/kvm-hw-pci-bridge-fix-QEMU-crash-because-of-pcie-root-po.patch

9bac43
From c424945b8ae8bbb6ce6aa6a9178b55b3b7498975 Mon Sep 17 00:00:00 2001
9bac43
From: Marcel Apfelbaum <marcel@redhat.com>
9bac43
Date: Thu, 18 Jan 2018 15:49:40 +0100
9bac43
Subject: [PATCH 07/21] hw/pci-bridge: fix QEMU crash because of pcie-root-port
9bac43
9bac43
RH-Author: Marcel Apfelbaum <marcel@redhat.com>
9bac43
Message-id: <20180118154940.32815-1-marcel@redhat.com>
9bac43
Patchwork-id: 78666
9bac43
O-Subject: [RHEL-7.5 qemu-kvm-rhev PATCH] hw/pci-bridge: fix QEMU crash because of pcie-root-port
9bac43
Bugzilla: 1520858
9bac43
RH-Acked-by: Laszlo Ersek <lersek@redhat.com>
9bac43
RH-Acked-by: Thomas Huth <thuth@redhat.com>
9bac43
RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
9bac43
9bac43
If we try to use more pcie_root_ports then available slots
9bac43
and an IO hint is passed to the port, QEMU crashes because
9bac43
we try to init the "IO hint" capability even if the device
9bac43
is not created.
9bac43
Fix it by checking for error before adding the capability,
9bac43
so QEMU can fail gracefully.
9bac43
9bac43
Signed-off-by: Marcel Apfelbaum <marcel@redhat.com>
9bac43
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
9bac43
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
9bac43
(cherry picked from commit fced4d00e68e7559c73746d963265f7fd0b6abf9)
9bac43
Signed-off-by: Marcel Apfelbaum <marcel@redhat.com>
9bac43
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
9bac43
---
9bac43
 hw/pci-bridge/gen_pcie_root_port.c | 7 ++++++-
9bac43
 1 file changed, 6 insertions(+), 1 deletion(-)
9bac43
9bac43
diff --git a/hw/pci-bridge/gen_pcie_root_port.c b/hw/pci-bridge/gen_pcie_root_port.c
9bac43
index ad4e6aa..0e2f2e8 100644
9bac43
--- a/hw/pci-bridge/gen_pcie_root_port.c
9bac43
+++ b/hw/pci-bridge/gen_pcie_root_port.c
9bac43
@@ -74,8 +74,13 @@ static void gen_rp_realize(DeviceState *dev, Error **errp)
9bac43
     PCIDevice *d = PCI_DEVICE(dev);
9bac43
     GenPCIERootPort *grp = GEN_PCIE_ROOT_PORT(d);
9bac43
     PCIERootPortClass *rpc = PCIE_ROOT_PORT_GET_CLASS(d);
9bac43
+    Error *local_err = NULL;
9bac43
 
9bac43
-    rpc->parent_realize(dev, errp);
9bac43
+    rpc->parent_realize(dev, &local_err);
9bac43
+    if (local_err) {
9bac43
+        error_propagate(errp, local_err);
9bac43
+        return;
9bac43
+    }
9bac43
 
9bac43
     int rc = pci_bridge_qemu_reserve_cap_init(d, 0, grp->bus_reserve,
9bac43
             grp->io_reserve, grp->mem_reserve, grp->pref32_reserve,
9bac43
-- 
9bac43
1.8.3.1
9bac43