dcavalca / rpms / qemu

Forked from rpms/qemu 10 months ago
Clone

Blame 0007-usb-xhci-fix-memory-leak-in-usb_xhci_exit.patch

3a13dd
From: Li Qiang <liqiang6-s@360.cn>
3a13dd
Date: Tue, 13 Sep 2016 03:20:03 -0700
3a13dd
Subject: [PATCH] usb:xhci:fix memory leak in usb_xhci_exit
3a13dd
3a13dd
If the xhci uses msix, it doesn't free the corresponding
3a13dd
memory, thus leading a memory leak. This patch avoid this.
3a13dd
3a13dd
Signed-off-by: Li Qiang <liqiang6-s@360.cn>
3a13dd
Message-id: 57d7d2e0.d4301c0a.d13e9.9a55@mx.google.com
3a13dd
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
3a13dd
(cherry picked from commit b53dd4495ced2432a0b652ea895e651d07336f7e)
3a13dd
---
3a13dd
 hw/usb/hcd-xhci.c | 3 +--
3a13dd
 1 file changed, 1 insertion(+), 2 deletions(-)
3a13dd
3a13dd
diff --git a/hw/usb/hcd-xhci.c b/hw/usb/hcd-xhci.c
3a13dd
index 188f954..281a2a5 100644
3a13dd
--- a/hw/usb/hcd-xhci.c
3a13dd
+++ b/hw/usb/hcd-xhci.c
3a13dd
@@ -3709,8 +3709,7 @@ static void usb_xhci_exit(PCIDevice *dev)
3a13dd
     /* destroy msix memory region */
3a13dd
     if (dev->msix_table && dev->msix_pba
3a13dd
         && dev->msix_entry_used) {
3a13dd
-        memory_region_del_subregion(&xhci->mem, &dev->msix_table_mmio);
3a13dd
-        memory_region_del_subregion(&xhci->mem, &dev->msix_pba_mmio);
3a13dd
+        msix_uninit(dev, &xhci->mem, &xhci->mem);
3a13dd
     }
3a13dd
 
3a13dd
     usb_bus_release(&xhci->bus);