[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-stable] [Qemu-devel] [PATCH] hw/pci-bridge: fix QEMU crash bec
From: |
Laszlo Ersek |
Subject: |
Re: [Qemu-stable] [Qemu-devel] [PATCH] hw/pci-bridge: fix QEMU crash because of pcie-root-port |
Date: |
Mon, 15 Jan 2018 16:54:21 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.2 |
On 01/10/18 20:09, Marcel Apfelbaum wrote:
> 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 <address@hidden>
> ---
> hw/pci-bridge/gen_pcie_root_port.c | 7 ++++++-
> 1 file changed, 6 insertions(+), 1 deletion(-)
In your opinion, can we add:
Cc: address@hidden
Fixes: 226263fb5cdaa4a4a95f1680fabbc9dd2123fd67
?
(Not sure if a stable branch is already open for 2.11. Commit
226263fb5cdaa appeared in 2.11.)
Ah, I'm silly. You CC'd stable up-front. :)
So, what about the Fixes tag?
>
> 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,
>
Reviewed-by: Laszlo Ersek <address@hidden>
Thanks
Laszlo