From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45990) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WzrpV-0004WI-Hu for qemu-devel@nongnu.org; Wed, 25 Jun 2014 14:22:06 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WzrpM-00067O-Ec for qemu-devel@nongnu.org; Wed, 25 Jun 2014 14:21:57 -0400 Sender: Paolo Bonzini From: Paolo Bonzini Date: Wed, 25 Jun 2014 20:21:37 +0200 Message-Id: <1403720497-5318-1-git-send-email-pbonzini@redhat.com> Subject: [Qemu-devel] [PATCH] serial-pci: remove memory regions from BAR before destroying them List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: qemu-trivial@nongnu.org, kraxel@redhat.com, armbru@redhat.com Otherwise, hot-unplug of pci-serial-2x trips the assertion in memory_region_destroy: (qemu) device_del gg (qemu) qemu-system-x86_64: /work/armbru/tmp/qemu/memory.c:1021: memory_region_destroy: Assertion `((&mr->subregions)->tqh_first == ((void *)0))' failed. Aborted (core dumped) Reported-by: Markus Armbruster Signed-off-by: Paolo Bonzini --- hw/char/serial-pci.c | 1 + 1 file changed, 1 insertion(+) diff --git a/hw/char/serial-pci.c b/hw/char/serial-pci.c index 6c25296..7340c8d 100644 --- a/hw/char/serial-pci.c +++ b/hw/char/serial-pci.c @@ -148,6 +148,7 @@ static void multi_serial_pci_exit(PCIDevice *dev) for (i = 0; i < pci->ports; i++) { s = pci->state + i; serial_exit_core(s); + memory_region_del_subregion(&pci->iobar, &s->io); memory_region_destroy(&s->io); g_free(pci->name[i]); } -- 1.9.3