Commit b09a61cc authored by Alan Stern's avatar Alan Stern Committed by Greg Kroah-Hartman

USB: EHCI: fix for leaking isochronous data

This patch (as1653) fixes a bug in ehci-hcd.  Unlike iTD entries, an
siTD entry in the periodic schedule may not complete until the frame
after the one it belongs to.  Consequently, when scanning the periodic
schedule it is necessary to start with the frame _preceding_ the one
where the previous scan ended.

Not doing this properly can result in memory leaks and failures to
complete isochronous URBs.
Signed-off-by: default avatarAlan Stern <stern@rowland.harvard.edu>
Reported-by: default avatarAndy Leiserson <andy@leiserson.org>
Cc: stable <stable@vger.kernel.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 03eb466f
...@@ -2212,11 +2212,11 @@ static void scan_isoc(struct ehci_hcd *ehci) ...@@ -2212,11 +2212,11 @@ static void scan_isoc(struct ehci_hcd *ehci)
} }
ehci->now_frame = now_frame; ehci->now_frame = now_frame;
frame = ehci->last_iso_frame;
for (;;) { for (;;) {
union ehci_shadow q, *q_p; union ehci_shadow q, *q_p;
__hc32 type, *hw_p; __hc32 type, *hw_p;
frame = ehci->last_iso_frame;
restart: restart:
/* scan each element in frame's queue for completions */ /* scan each element in frame's queue for completions */
q_p = &ehci->pshadow [frame]; q_p = &ehci->pshadow [frame];
...@@ -2321,6 +2321,9 @@ static void scan_isoc(struct ehci_hcd *ehci) ...@@ -2321,6 +2321,9 @@ static void scan_isoc(struct ehci_hcd *ehci)
/* Stop when we have reached the current frame */ /* Stop when we have reached the current frame */
if (frame == now_frame) if (frame == now_frame)
break; break;
ehci->last_iso_frame = (frame + 1) & fmask;
/* The last frame may still have active siTDs */
ehci->last_iso_frame = frame;
frame = (frame + 1) & fmask;
} }
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment