qemu-trivial.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Thomas Huth <thuth@redhat.com>
To: Li Qiang <liq3ea@gmail.com>, kraxel@redhat.com, qemu-devel@nongnu.org
Cc: Li Qiang <liqiang6-s@360.cn>, qemu-trivial@nongnu.org
Subject: Re: [Qemu-trivial] [Qemu-devel] [PATCH] usb: ehci: fix memory leak in ehci_process_itd
Date: Mon, 26 Sep 2016 11:45:23 +0200	[thread overview]
Message-ID: <b12a46ed-a663-9ecb-d401-95fffeb8d42b@redhat.com> (raw)
In-Reply-To: <57df5212.87adc20a.7f06f.fda3@mx.google.com>


[-- Attachment #1.1: Type: text/plain, Size: 1103 bytes --]

On 19.09.2016 04:48, Li Qiang wrote:
> From: Li Qiang <liqiang6-s@360.cn>
> 
> 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 <liqiang6-s@360.cn>
> ---
>  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 <thuth@redhat.com>



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

       reply	other threads:[~2016-09-26  9:45 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <57df5212.87adc20a.7f06f.fda3@mx.google.com>
2016-09-26  9:45 ` Thomas Huth [this message]
2016-09-29 15:54   ` [Qemu-trivial] [PATCH] usb: ehci: fix memory leak in ehci_process_itd Michael Tokarev

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=b12a46ed-a663-9ecb-d401-95fffeb8d42b@redhat.com \
    --to=thuth@redhat.com \
    --cc=kraxel@redhat.com \
    --cc=liq3ea@gmail.com \
    --cc=liqiang6-s@360.cn \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-trivial@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).