qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PULL 0/1] ppc-for-2.6 queue 20160423
@ 2016-04-23  6:57 David Gibson
  2016-04-23  6:58 ` [Qemu-devel] [PULL 1/1] hw/ppc/spapr: Fix crash when specifying bad parameters to spapr-pci-host-bridge David Gibson
  2016-04-25 10:47 ` [Qemu-devel] [PULL 0/1] ppc-for-2.6 queue 20160423 Peter Maydell
  0 siblings, 2 replies; 3+ messages in thread
From: David Gibson @ 2016-04-23  6:57 UTC (permalink / raw)
  To: peter.maydell; +Cc: agraf, qemu-devel, qemu-ppc, David Gibson

The following changes since commit 53343338a6e7b83777b82803398572b40afc8c0f:

  Merge remote-tracking branch 'remotes/kevin/tags/for-upstream' into staging (2016-04-22 16:17:12 +0100)

are available in the git repository at:

  git://github.com/dgibson/qemu.git tags/ppc-for-2.6-20160423

for you to fetch changes up to da34fed707a3a3ffa229f4e724aea06da1b53fb0:

  hw/ppc/spapr: Fix crash when specifying bad parameters to spapr-pci-host-bridge (2016-04-23 16:52:20 +1000)

----------------------------------------------------------------
ppc patch queue for 2016-03-23

A single fix for a bug in parameter handling for the spapr PCI host
bridge.

----------------------------------------------------------------

Peter,

This is definitely a bug fix, but it's not a regression since 2.5.
Your judgement call as to whether to merge it this late in the 2.6
cycle.

Thomas Huth (1):
      hw/ppc/spapr: Fix crash when specifying bad parameters to spapr-pci-host-bridge

 hw/ppc/spapr.c     | 9 ++++-----
 hw/ppc/spapr_pci.c | 3 +++
 2 files changed, 7 insertions(+), 5 deletions(-)

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Qemu-devel] [PULL 1/1] hw/ppc/spapr: Fix crash when specifying bad parameters to spapr-pci-host-bridge
  2016-04-23  6:57 [Qemu-devel] [PULL 0/1] ppc-for-2.6 queue 20160423 David Gibson
@ 2016-04-23  6:58 ` David Gibson
  2016-04-25 10:47 ` [Qemu-devel] [PULL 0/1] ppc-for-2.6 queue 20160423 Peter Maydell
  1 sibling, 0 replies; 3+ messages in thread
From: David Gibson @ 2016-04-23  6:58 UTC (permalink / raw)
  To: peter.maydell; +Cc: agraf, qemu-devel, qemu-ppc, Thomas Huth, David Gibson

From: Thomas Huth <thuth@redhat.com>

QEMU currently crashes when using bad parameters for the
spapr-pci-host-bridge device:

$ qemu-system-ppc64 -device spapr-pci-host-bridge,buid=0x123,liobn=0x321,mem_win_addr=0x1,io_win_addr=0x10
Segmentation fault

The problem is that spapr_tce_find_by_liobn() might return NULL, but
the code in spapr_populate_pci_dt() does not check for this condition
and then tries to dereference this NULL pointer.
Apart from that, the return value of spapr_populate_pci_dt() also
has to be checked for all PCI buses, not only for the last one, to
make sure we catch all errors.

Signed-off-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
---
 hw/ppc/spapr.c     | 9 ++++-----
 hw/ppc/spapr_pci.c | 3 +++
 2 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
index feaab08..b69995e 100644
--- a/hw/ppc/spapr.c
+++ b/hw/ppc/spapr.c
@@ -940,11 +940,10 @@ static void spapr_finalize_fdt(sPAPRMachineState *spapr,
 
     QLIST_FOREACH(phb, &spapr->phbs, list) {
         ret = spapr_populate_pci_dt(phb, PHANDLE_XICP, fdt);
-    }
-
-    if (ret < 0) {
-        fprintf(stderr, "couldn't setup PCI devices in fdt\n");
-        exit(1);
+        if (ret < 0) {
+            error_report("couldn't setup PCI devices in fdt");
+            exit(1);
+        }
     }
 
     /* RTAS */
diff --git a/hw/ppc/spapr_pci.c b/hw/ppc/spapr_pci.c
index 8c20d34..573e635 100644
--- a/hw/ppc/spapr_pci.c
+++ b/hw/ppc/spapr_pci.c
@@ -1816,6 +1816,9 @@ int spapr_populate_pci_dt(sPAPRPHBState *phb,
                      sizeof(interrupt_map)));
 
     tcet = spapr_tce_find_by_liobn(SPAPR_PCI_LIOBN(phb->index, 0));
+    if (!tcet) {
+        return -1;
+    }
     spapr_dma_dt(fdt, bus_off, "ibm,dma-window",
                  tcet->liobn, tcet->bus_offset,
                  tcet->nb_table << tcet->page_shift);
-- 
2.5.5

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] [PULL 0/1] ppc-for-2.6 queue 20160423
  2016-04-23  6:57 [Qemu-devel] [PULL 0/1] ppc-for-2.6 queue 20160423 David Gibson
  2016-04-23  6:58 ` [Qemu-devel] [PULL 1/1] hw/ppc/spapr: Fix crash when specifying bad parameters to spapr-pci-host-bridge David Gibson
@ 2016-04-25 10:47 ` Peter Maydell
  1 sibling, 0 replies; 3+ messages in thread
From: Peter Maydell @ 2016-04-25 10:47 UTC (permalink / raw)
  To: David Gibson; +Cc: Alexander Graf, QEMU Developers, qemu-ppc@nongnu.org

On 23 April 2016 at 07:57, David Gibson <david@gibson.dropbear.id.au> wrote:
> The following changes since commit 53343338a6e7b83777b82803398572b40afc8c0f:
>
>   Merge remote-tracking branch 'remotes/kevin/tags/for-upstream' into staging (2016-04-22 16:17:12 +0100)
>
> are available in the git repository at:
>
>   git://github.com/dgibson/qemu.git tags/ppc-for-2.6-20160423
>
> for you to fetch changes up to da34fed707a3a3ffa229f4e724aea06da1b53fb0:
>
>   hw/ppc/spapr: Fix crash when specifying bad parameters to spapr-pci-host-bridge (2016-04-23 16:52:20 +1000)
>
> ----------------------------------------------------------------
> ppc patch queue for 2016-03-23
>
> A single fix for a bug in parameter handling for the spapr PCI host
> bridge.
>
> ----------------------------------------------------------------
>
> Peter,
>
> This is definitely a bug fix, but it's not a regression since 2.5.
> Your judgement call as to whether to merge it this late in the 2.6
> cycle.

Only affects spapr, so I'm happy with it if you are. Applied to master.

thanks
-- PMM

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-04-25 10:47 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-04-23  6:57 [Qemu-devel] [PULL 0/1] ppc-for-2.6 queue 20160423 David Gibson
2016-04-23  6:58 ` [Qemu-devel] [PULL 1/1] hw/ppc/spapr: Fix crash when specifying bad parameters to spapr-pci-host-bridge David Gibson
2016-04-25 10:47 ` [Qemu-devel] [PULL 0/1] ppc-for-2.6 queue 20160423 Peter Maydell

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).