summaryrefslogtreecommitdiffstats
path: root/hw/pci-bridge
diff options
context:
space:
mode:
authorMarcel Apfelbaum2018-01-10 20:09:09 +0100
committerMichael S. Tsirkin2018-01-18 20:52:38 +0100
commitfced4d00e68e7559c73746d963265f7fd0b6abf9 (patch)
tree9c1182fdb3ee28fb6ba4ebc2a339a010ba4e5888 /hw/pci-bridge
parentintel-iommu: Extend address width to 48 bits (diff)
downloadqemu-fced4d00e68e7559c73746d963265f7fd0b6abf9.tar.gz
qemu-fced4d00e68e7559c73746d963265f7fd0b6abf9.tar.xz
qemu-fced4d00e68e7559c73746d963265f7fd0b6abf9.zip
hw/pci-bridge: fix QEMU crash because of pcie-root-port
If we try to use more pcie_root_ports then available slots and an IO hint is passed to the port, QEMU crashes because we try to init the "IO hint" capability even if the device is not created. Fix it by checking for error before adding the capability, so QEMU can fail gracefully. Signed-off-by: Marcel Apfelbaum <marcel@redhat.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Diffstat (limited to 'hw/pci-bridge')
-rw-r--r--hw/pci-bridge/gen_pcie_root_port.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/hw/pci-bridge/gen_pcie_root_port.c b/hw/pci-bridge/gen_pcie_root_port.c
index ad4e6aa7ff..0e2f2e8bf1 100644
--- a/hw/pci-bridge/gen_pcie_root_port.c
+++ b/hw/pci-bridge/gen_pcie_root_port.c
@@ -74,8 +74,13 @@ static void gen_rp_realize(DeviceState *dev, Error **errp)
PCIDevice *d = PCI_DEVICE(dev);
GenPCIERootPort *grp = GEN_PCIE_ROOT_PORT(d);
PCIERootPortClass *rpc = PCIE_ROOT_PORT_GET_CLASS(d);
+ Error *local_err = NULL;
- rpc->parent_realize(dev, errp);
+ rpc->parent_realize(dev, &local_err);
+ if (local_err) {
+ error_propagate(errp, local_err);
+ return;
+ }
int rc = pci_bridge_qemu_reserve_cap_init(d, 0, grp->bus_reserve,
grp->io_reserve, grp->mem_reserve, grp->pref32_reserve,