* [Qemu-devel] [PATCH] usb: ehci: fix memory leak in ehci_process_itd
@ 2016-09-19 2:48 Li Qiang
2016-09-26 6:26 ` 李强
2016-09-26 9:45 ` Thomas Huth
0 siblings, 2 replies; 4+ messages in thread
From: Li Qiang @ 2016-09-19 2:48 UTC (permalink / raw)
To: kraxel, qemu-devel; +Cc: Li Qiang
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
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);
--
1.8.3.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] [PATCH] usb: ehci: fix memory leak in ehci_process_itd
2016-09-19 2:48 [Qemu-devel] [PATCH] usb: ehci: fix memory leak in ehci_process_itd Li Qiang
@ 2016-09-26 6:26 ` 李强
2016-09-26 9:45 ` Thomas Huth
1 sibling, 0 replies; 4+ messages in thread
From: 李强 @ 2016-09-26 6:26 UTC (permalink / raw)
To: kraxel, qemu-devel; +Cc: Li Qiang
Ping!
2016-09-19 10:48 GMT+08:00 Li Qiang <liq3ea@gmail.com>:
> 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
> 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);
> --
> 1.8.3.1
>
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] [PATCH] usb: ehci: fix memory leak in ehci_process_itd
2016-09-19 2:48 [Qemu-devel] [PATCH] usb: ehci: fix memory leak in ehci_process_itd Li Qiang
2016-09-26 6:26 ` 李强
@ 2016-09-26 9:45 ` Thomas Huth
2016-09-29 15:54 ` Michael Tokarev
1 sibling, 1 reply; 4+ messages in thread
From: Thomas Huth @ 2016-09-26 9:45 UTC (permalink / raw)
To: Li Qiang, kraxel, qemu-devel; +Cc: Li Qiang, qemu-trivial
[-- Attachment #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 --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] [PATCH] usb: ehci: fix memory leak in ehci_process_itd
2016-09-26 9:45 ` Thomas Huth
@ 2016-09-29 15:54 ` Michael Tokarev
0 siblings, 0 replies; 4+ messages in thread
From: Michael Tokarev @ 2016-09-29 15:54 UTC (permalink / raw)
To: Thomas Huth, Li Qiang, kraxel, qemu-devel; +Cc: qemu-trivial, Li Qiang
Applied to -trivial with comment fix, thanks!
/mjt
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2016-09-29 15:54 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-09-19 2:48 [Qemu-devel] [PATCH] usb: ehci: fix memory leak in ehci_process_itd Li Qiang
2016-09-26 6:26 ` 李强
2016-09-26 9:45 ` Thomas Huth
2016-09-29 15:54 ` Michael Tokarev
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).