808a2e2
From: Li Qiang <liqiang6-s@360.cn>
808a2e2
Date: Sun, 18 Sep 2016 19:48:35 -0700
808a2e2
Subject: [PATCH] usb: ehci: fix memory leak in ehci_process_itd
808a2e2
808a2e2
While processing isochronous transfer descriptors(iTD), if the page
808a2e2
select(PG) field value is out of bands it will return. In this
808a2e2
situation the ehci's sg list is not freed thus leading to a memory
808a2e2
leak issue. This patch avoid this.
808a2e2
808a2e2
Signed-off-by: Li Qiang <liqiang6-s@360.cn>
808a2e2
Reviewed-by: Thomas Huth <thuth@redhat.com>
808a2e2
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
808a2e2
(cherry picked from commit b16c129daf0fed91febbb88de23dae8271c8898a)
808a2e2
---
808a2e2
 hw/usb/hcd-ehci.c | 1 +
808a2e2
 1 file changed, 1 insertion(+)
808a2e2
808a2e2
diff --git a/hw/usb/hcd-ehci.c b/hw/usb/hcd-ehci.c
808a2e2
index 43a8f7a..92241bb 100644
808a2e2
--- a/hw/usb/hcd-ehci.c
808a2e2
+++ b/hw/usb/hcd-ehci.c
808a2e2
@@ -1426,6 +1426,7 @@ static int ehci_process_itd(EHCIState *ehci,
808a2e2
             if (off + len > 4096) {
808a2e2
                 /* transfer crosses page border */
808a2e2
                 if (pg == 6) {
808a2e2
+                    qemu_sglist_destroy(&ehci->isgl);
808a2e2
                     return -1;  /* avoid page pg + 1 */
808a2e2
                 }
808a2e2
                 ptr2 = (itd->bufptr[pg + 1] & ITD_BUFPTR_MASK);