thebeanogamer / rpms / qemu-kvm

Forked from rpms/qemu-kvm 5 months ago
Clone
958e1b
From 1a353074ec2bc18c3f9dd0a56e5febb2cdc1892c Mon Sep 17 00:00:00 2001
958e1b
From: Gerd Hoffmann <kraxel@redhat.com>
958e1b
Date: Fri, 11 Jul 2014 14:20:45 +0200
958e1b
Subject: [PATCH 11/43] xhci: Fix memory leak on xhci_disable_ep
958e1b
958e1b
Message-id: <1405088470-24115-13-git-send-email-kraxel@redhat.com>
958e1b
Patchwork-id: 59821
958e1b
O-Subject: [RHEL-7.1 qemu-kvm PATCH 12/37] xhci: Fix memory leak on xhci_disable_ep
958e1b
Bugzilla: 980833
958e1b
RH-Acked-by: Dr. David Alan Gilbert (git) <dgilbert@redhat.com>
958e1b
RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
958e1b
RH-Acked-by: Laszlo Ersek <lersek@redhat.com>
958e1b
958e1b
From: Hans de Goede <hdegoede@redhat.com>
958e1b
958e1b
The USBPacket-s in the transfers need to be cleaned up so that the memory
958e1b
allocated by the iovec in there gets freed.
958e1b
958e1b
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
958e1b
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
958e1b
(cherry picked from commit b21da4e504fbdb907543a918b190783dc896d8e1)
958e1b
---
958e1b
 hw/usb/hcd-xhci.c | 5 +++++
958e1b
 1 file changed, 5 insertions(+)
958e1b
958e1b
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
958e1b
---
958e1b
 hw/usb/hcd-xhci.c | 5 +++++
958e1b
 1 file changed, 5 insertions(+)
958e1b
958e1b
diff --git a/hw/usb/hcd-xhci.c b/hw/usb/hcd-xhci.c
958e1b
index 56145a5..bb3bba3 100644
958e1b
--- a/hw/usb/hcd-xhci.c
958e1b
+++ b/hw/usb/hcd-xhci.c
958e1b
@@ -1382,6 +1382,7 @@ static TRBCCode xhci_disable_ep(XHCIState *xhci, unsigned int slotid,
958e1b
 {
958e1b
     XHCISlot *slot;
958e1b
     XHCIEPContext *epctx;
958e1b
+    int i;
958e1b
 
958e1b
     trace_usb_xhci_ep_disable(slotid, epid);
958e1b
     assert(slotid >= 1 && slotid <= xhci->numslots);
958e1b
@@ -1402,6 +1403,10 @@ static TRBCCode xhci_disable_ep(XHCIState *xhci, unsigned int slotid,
958e1b
         xhci_free_streams(epctx);
958e1b
     }
958e1b
 
958e1b
+    for (i = 0; i < ARRAY_SIZE(epctx->transfers); i++) {
958e1b
+        usb_packet_cleanup(&epctx->transfers[i].packet);
958e1b
+    }
958e1b
+
958e1b
     xhci_set_ep_state(xhci, epctx, NULL, EP_DISABLED);
958e1b
 
958e1b
     qemu_free_timer(epctx->kick_timer);
958e1b
-- 
958e1b
1.8.3.1
958e1b