qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Philippe Mathieu-Daudé" <philmd@redhat.com>
To: qemu-devel@nongnu.org, "Michael S. Tsirkin" <mst@redhat.com>
Cc: Markus Armbruster <armbru@redhat.com>
Subject: Re: [PATCH] hw/pci: Have safer pcie_bus_realize() by checking error path
Date: Mon, 1 Mar 2021 09:19:09 +0100	[thread overview]
Message-ID: <1e1b3d3a-a891-c3cd-0496-2a139737ec63@redhat.com> (raw)
In-Reply-To: <20210201153700.618946-1-philmd@redhat.com>

ping?

On 2/1/21 4:37 PM, Philippe Mathieu-Daudé wrote:
> 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>
> ---
>  hw/pci/pci.c | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/hw/pci/pci.c b/hw/pci/pci.c
> index 512e9042ffa..0d12e94a02e 100644
> --- a/hw/pci/pci.c
> +++ b/hw/pci/pci.c
> @@ -130,8 +130,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
> 



      reply	other threads:[~2021-03-01  8:19 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-01 15:37 [PATCH] hw/pci: Have safer pcie_bus_realize() by checking error path Philippe Mathieu-Daudé
2021-03-01  8:19 ` Philippe Mathieu-Daudé [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1e1b3d3a-a891-c3cd-0496-2a139737ec63@redhat.com \
    --to=philmd@redhat.com \
    --cc=armbru@redhat.com \
    --cc=mst@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).