summaryrefslogtreecommitdiffstats
path: root/hw
diff options
context:
space:
mode:
authorPhilippe Mathieu-Daudé2021-02-01 16:37:00 +0100
committerMichael S. Tsirkin2021-03-02 15:16:18 +0100
commitb52fa0ea45bea494a953dd766151d584a28e87e5 (patch)
treed71d632dc72a62e8bea172c78dac0bfe23b278de /hw
parentvirtio-net: handle zero mac for a vdpa peer (diff)
downloadqemu-b52fa0ea45bea494a953dd766151d584a28e87e5.tar.gz
qemu-b52fa0ea45bea494a953dd766151d584a28e87e5.tar.xz
qemu-b52fa0ea45bea494a953dd766151d584a28e87e5.zip
hw/pci: Have safer pcie_bus_realize() by checking error path
While pci_bus_realize() currently does not use the Error* argument, it would be an error to leave pcie_bus_realize() setting bus->flags if pci_bus_realize() had failed. Fix by using a local Error* and return early (propagating the error) if pci_bus_realize() failed. Reported-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com> Message-Id: <20210201153700.618946-1-philmd@redhat.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Diffstat (limited to 'hw')
-rw-r--r--hw/pci/pci.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/hw/pci/pci.c b/hw/pci/pci.c
index fa97a671d1..0eadcdbc9e 100644
--- a/hw/pci/pci.c
+++ b/hw/pci/pci.c
@@ -132,8 +132,13 @@ static void pci_bus_realize(BusState *qbus, Error **errp)
static void pcie_bus_realize(BusState *qbus, Error **errp)
{
PCIBus *bus = PCI_BUS(qbus);
+ Error *local_err = NULL;
- pci_bus_realize(qbus, errp);
+ pci_bus_realize(qbus, &local_err);
+ if (local_err) {
+ error_propagate(errp, local_err);
+ return;
+ }
/*
* A PCI-E bus can support extended config space if it's the root