[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH] usb: ehci: fix memory leak in ehci_process_itd
From: |
Thomas Huth |
Subject: |
Re: [Qemu-devel] [PATCH] usb: ehci: fix memory leak in ehci_process_itd |
Date: |
Mon, 26 Sep 2016 11:45:23 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.3.0 |
On 19.09.2016 04:48, Li Qiang wrote:
> From: Li Qiang <address@hidden>
>
> 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 doesn't be freed thus leading a memory
s/doesn't be/is not/
> leak issue. This patch avoid this.
>
> Signed-off-by: Li Qiang <address@hidden>
> ---
> hw/usb/hcd-ehci.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/hw/usb/hcd-ehci.c b/hw/usb/hcd-ehci.c
> index b093db7..f4ece9a 100644
> --- a/hw/usb/hcd-ehci.c
> +++ b/hw/usb/hcd-ehci.c
> @@ -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);
>
Looks right to me.
Reviewed-by: Thomas Huth <address@hidden>
signature.asc
Description: OpenPGP digital signature