qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PULL 0/1] pci: fix
@ 2017-04-04 15:35 Michael S. Tsirkin
  2017-04-04 15:35 ` [Qemu-devel] [PULL 1/1] pci: Only unmap bus_master_enabled_region if was added previously Michael S. Tsirkin
  2017-04-04 17:00 ` [Qemu-devel] [PULL 0/1] pci: fix Peter Maydell
  0 siblings, 2 replies; 3+ messages in thread
From: Michael S. Tsirkin @ 2017-04-04 15:35 UTC (permalink / raw)
  To: qemu-devel; +Cc: Peter Maydell, jcody

The following changes since commit 87cc4c61020addea6a001b94b662596b1896d1b3:

  Merge remote-tracking branch 'remotes/bonzini/tags/for-upstream' into staging (2017-04-04 11:40:55 +0100)

are available in the git repository at:

  git://git.kernel.org/pub/scm/virt/kvm/mst/qemu.git tags/for_upstream

for you to fetch changes up to 193982c6f9424779b53a168fe32ebc30a776cbf1:

  pci: Only unmap bus_master_enabled_region if was added previously (2017-04-04 18:32:25 +0300)

----------------------------------------------------------------
pci: fix

A single bugfix for a error handling issue in pci.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>

----------------------------------------------------------------
Alexey Kardashevskiy (1):
      pci: Only unmap bus_master_enabled_region if was added previously

 hw/pci/pci.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

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

* [Qemu-devel] [PULL 1/1] pci: Only unmap bus_master_enabled_region if was added previously
  2017-04-04 15:35 [Qemu-devel] [PULL 0/1] pci: fix Michael S. Tsirkin
@ 2017-04-04 15:35 ` Michael S. Tsirkin
  2017-04-04 17:00 ` [Qemu-devel] [PULL 0/1] pci: fix Peter Maydell
  1 sibling, 0 replies; 3+ messages in thread
From: Michael S. Tsirkin @ 2017-04-04 15:35 UTC (permalink / raw)
  To: qemu-devel
  Cc: Peter Maydell, Alexey Kardashevskiy, Max Reitz, Marcel Apfelbaum,
	Paolo Bonzini, John Snow, jcody

From: Alexey Kardashevskiy <aik@ozlabs.ru>

Normally pci_init_bus_master() would be called either via
bus->machine_done.notify or directly from do_pci_register_device().

However if a device's realize() failed, pci_init_bus_master() is not
called, and do_pci_unregister_device() fails on
memory_region_del_subregion() as it was not mapped.

This adds a check that subregion was mapped before unmapping it.

Fixes: c53598ed18e4 ("pci: Add missing drop of bus master AS reference")
Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: Marcel Apfelbaum <marcel@redhat.com>
Acked-by: Paolo Bonzini <pbonzini@redhat.com>
Tested-by: John Snow <jsnow@redhat.com>
---
 hw/pci/pci.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/hw/pci/pci.c b/hw/pci/pci.c
index bd8043c..259483b 100644
--- a/hw/pci/pci.c
+++ b/hw/pci/pci.c
@@ -869,8 +869,10 @@ static void do_pci_unregister_device(PCIDevice *pci_dev)
     pci_dev->bus->devices[pci_dev->devfn] = NULL;
     pci_config_free(pci_dev);
 
-    memory_region_del_subregion(&pci_dev->bus_master_container_region,
-                                &pci_dev->bus_master_enable_region);
+    if (memory_region_is_mapped(&pci_dev->bus_master_enable_region)) {
+        memory_region_del_subregion(&pci_dev->bus_master_container_region,
+                                    &pci_dev->bus_master_enable_region);
+    }
     address_space_destroy(&pci_dev->bus_master_as);
 }
 
-- 
MST

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

* Re: [Qemu-devel] [PULL 0/1] pci: fix
  2017-04-04 15:35 [Qemu-devel] [PULL 0/1] pci: fix Michael S. Tsirkin
  2017-04-04 15:35 ` [Qemu-devel] [PULL 1/1] pci: Only unmap bus_master_enabled_region if was added previously Michael S. Tsirkin
@ 2017-04-04 17:00 ` Peter Maydell
  1 sibling, 0 replies; 3+ messages in thread
From: Peter Maydell @ 2017-04-04 17:00 UTC (permalink / raw)
  To: Michael S. Tsirkin; +Cc: QEMU Developers, Jeff Cody

On 4 April 2017 at 16:35, Michael S. Tsirkin <mst@redhat.com> wrote:
> The following changes since commit 87cc4c61020addea6a001b94b662596b1896d1b3:
>
>   Merge remote-tracking branch 'remotes/bonzini/tags/for-upstream' into staging (2017-04-04 11:40:55 +0100)
>
> are available in the git repository at:
>
>   git://git.kernel.org/pub/scm/virt/kvm/mst/qemu.git tags/for_upstream
>
> for you to fetch changes up to 193982c6f9424779b53a168fe32ebc30a776cbf1:
>
>   pci: Only unmap bus_master_enabled_region if was added previously (2017-04-04 18:32:25 +0300)
>
> ----------------------------------------------------------------
> pci: fix
>
> A single bugfix for a error handling issue in pci.
>
> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
>
> ----------------------------------------------------------------
> Alexey Kardashevskiy (1):
>       pci: Only unmap bus_master_enabled_region if was added previously

Applied, thanks.

-- PMM

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

end of thread, other threads:[~2017-04-04 17:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-04-04 15:35 [Qemu-devel] [PULL 0/1] pci: fix Michael S. Tsirkin
2017-04-04 15:35 ` [Qemu-devel] [PULL 1/1] pci: Only unmap bus_master_enabled_region if was added previously Michael S. Tsirkin
2017-04-04 17:00 ` [Qemu-devel] [PULL 0/1] pci: fix 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).