[Qemu-devel] [PATCH] xio3130_downstream: Report error if pcie_chassis_add_slot() failed

Eduardo Habkost posted 1 patch 6 years, 8 months ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20170825195406.19624-1-ehabkost@redhat.com
Test FreeBSD passed
Test checkpatch passed
Test docker passed
Test s390x passed
hw/pci-bridge/xio3130_downstream.c | 1 +
1 file changed, 1 insertion(+)
[Qemu-devel] [PATCH] xio3130_downstream: Report error if pcie_chassis_add_slot() failed
Posted by Eduardo Habkost 6 years, 8 months ago
On commit f8cd1b02 ("pci: Convert to realize"), no error_set*()
call was added for the pcie_chassis_add_slot() error case.
pcie_chassis_add_slot() errors get ignored, making QEMU crash
later.  e.g.:

  $ qemu-system-x86_64 -device ioh3420 -device xio3130-downstream
  qemu-system-x86_64: memory.c:2166: memory_region_del_subregion: Assertion `subregion->container == mr' failed.
  Aborted (core dumped)

Fix it by reporting the error using error_setg().

Fixes: f8cd1b0201c41d88bb97dcafb80348a0e88d8805
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
 hw/pci-bridge/xio3130_downstream.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/hw/pci-bridge/xio3130_downstream.c b/hw/pci-bridge/xio3130_downstream.c
index e706f36..5a882b0 100644
--- a/hw/pci-bridge/xio3130_downstream.c
+++ b/hw/pci-bridge/xio3130_downstream.c
@@ -94,6 +94,7 @@ static void xio3130_downstream_realize(PCIDevice *d, Error **errp)
     pcie_chassis_create(s->chassis);
     rc = pcie_chassis_add_slot(s);
     if (rc < 0) {
+        error_setg(errp, "Can't add chassis slot, error %d", rc);
         goto err_pcie_cap;
     }
 
-- 
2.9.4


Re: [Qemu-devel] [PATCH] xio3130_downstream: Report error if pcie_chassis_add_slot() failed
Posted by Marcel Apfelbaum 6 years, 7 months ago
Hi Eduardo,

On 25/08/2017 22:54, Eduardo Habkost wrote:
> On commit f8cd1b02 ("pci: Convert to realize"), no error_set*()
> call was added for the pcie_chassis_add_slot() error case.
> pcie_chassis_add_slot() errors get ignored, making QEMU crash
> later.  e.g.:
> 
>    $ qemu-system-x86_64 -device ioh3420 -device xio3130-downstream
>    qemu-system-x86_64: memory.c:2166: memory_region_del_subregion: Assertion `subregion->container == mr' failed.
>    Aborted (core dumped)
> 
> Fix it by reporting the error using error_setg().
> 
> Fixes: f8cd1b0201c41d88bb97dcafb80348a0e88d8805
> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
> ---
>   hw/pci-bridge/xio3130_downstream.c | 1 +
>   1 file changed, 1 insertion(+)
> 
> diff --git a/hw/pci-bridge/xio3130_downstream.c b/hw/pci-bridge/xio3130_downstream.c
> index e706f36..5a882b0 100644
> --- a/hw/pci-bridge/xio3130_downstream.c
> +++ b/hw/pci-bridge/xio3130_downstream.c
> @@ -94,6 +94,7 @@ static void xio3130_downstream_realize(PCIDevice *d, Error **errp)
>       pcie_chassis_create(s->chassis);
>       rc = pcie_chassis_add_slot(s);
>       if (rc < 0) {
> +        error_setg(errp, "Can't add chassis slot, error %d", rc);
>           goto err_pcie_cap;
>       }
>   
> 


Reviewed-by: Marcel Apfelbaum <marcel@redhat.com>

Thanks,
Marcel

Re: [Qemu-devel] [PATCH] xio3130_downstream: Report error if pcie_chassis_add_slot() failed
Posted by Eduardo Habkost 6 years, 7 months ago
On Sun, Aug 27, 2017 at 10:44:26AM +0300, Marcel Apfelbaum wrote:
> Hi Eduardo,
> 
> On 25/08/2017 22:54, Eduardo Habkost wrote:
> > On commit f8cd1b02 ("pci: Convert to realize"), no error_set*()
> > call was added for the pcie_chassis_add_slot() error case.
> > pcie_chassis_add_slot() errors get ignored, making QEMU crash
> > later.  e.g.:
> > 
> >    $ qemu-system-x86_64 -device ioh3420 -device xio3130-downstream
> >    qemu-system-x86_64: memory.c:2166: memory_region_del_subregion: Assertion `subregion->container == mr' failed.
> >    Aborted (core dumped)
> > 
> > Fix it by reporting the error using error_setg().
> > 
> > Fixes: f8cd1b0201c41d88bb97dcafb80348a0e88d8805
> > Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
> > ---
> >   hw/pci-bridge/xio3130_downstream.c | 1 +
> >   1 file changed, 1 insertion(+)
> > 
> > diff --git a/hw/pci-bridge/xio3130_downstream.c b/hw/pci-bridge/xio3130_downstream.c
> > index e706f36..5a882b0 100644
> > --- a/hw/pci-bridge/xio3130_downstream.c
> > +++ b/hw/pci-bridge/xio3130_downstream.c
> > @@ -94,6 +94,7 @@ static void xio3130_downstream_realize(PCIDevice *d, Error **errp)
> >       pcie_chassis_create(s->chassis);
> >       rc = pcie_chassis_add_slot(s);
> >       if (rc < 0) {
> > +        error_setg(errp, "Can't add chassis slot, error %d", rc);
> >           goto err_pcie_cap;
> >       }
> > 
> 
> 
> Reviewed-by: Marcel Apfelbaum <marcel@redhat.com>

Thanks!

Michael, do you want to merge this, or should I queue it?

-- 
Eduardo