Skip to content

Commit

Permalink
usb: ehci: fix memory leak in ehci_process_itd
Browse files Browse the repository at this point in the history
While processing isochronous transfer descriptors(iTD), if the page
select(PG) field value is out of bands it will return. In this
situation the ehci's sg list is not freed thus leading to a memory
leak issue. This patch avoid this.

Signed-off-by: Li Qiang <liqiang6-s@360.cn>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
  • Loading branch information
Li Qiang authored and Michael Tokarev committed Oct 8, 2016
1 parent a43edcf commit b16c129
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions hw/usb/hcd-ehci.c
Expand Up @@ -1426,6 +1426,7 @@ static int ehci_process_itd(EHCIState *ehci,
if (off + len > 4096) {
/* transfer crosses page border */
if (pg == 6) {
qemu_sglist_destroy(&ehci->isgl);
return -1; /* avoid page pg + 1 */
}
ptr2 = (itd->bufptr[pg + 1] & ITD_BUFPTR_MASK);
Expand Down

0 comments on commit b16c129

Please sign in to comment.