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

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