USB: EHCI: bugfix: urb->hcpriv should not be NULL
authorAlan Stern <stern@rowland.harvard.edu>
Thu, 8 Nov 2012 15:17:01 +0000 (10:17 -0500)
committerBen Hutchings <ben@decadent.org.uk>
Thu, 3 Jan 2013 03:33:04 +0000 (03:33 +0000)
commitb9678188b8f570d5c620dd3822485319c38a3709
tree5787d16d0022b6e18ce9a351f0c6660a72a89bc1
parent0223d1abe9bc4a3b3b5ffb0432cb6a08eff3389b
USB: EHCI: bugfix: urb->hcpriv should not be NULL

commit 2656a9abcf1ec8dd5fee6a75d6997a0f2fa0094e upstream.

This patch (as1632b) fixes a bug in ehci-hcd.  The USB core uses
urb->hcpriv to determine whether or not an URB is active; host
controller drivers are supposed to set this pointer to a non-NULL
value when an URB is queued.  However ehci-hcd sets it to NULL for
isochronous URBs, which defeats the check in usbcore.

In itself this isn't a big deal.  But people have recently found that
certain sequences of actions will cause the snd-usb-audio driver to
reuse URBs without waiting for them to complete.  In the absence of
proper checking by usbcore, the URBs get added to their endpoint list
twice.  This leads to list corruption and a system freeze.

The patch makes ehci-hcd assign a meaningful value to urb->hcpriv for
isochronous URBs.  Improving robustness always helps.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Reported-by: Artem S. Tashkinov <t.artem@lycos.com>
Reported-by: Christof Meerwald <cmeerw@cmeerw.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
[bwh: Backported to 3.2:
 - Adjust context
 - Also use usb_pipetype() to work out whether we should call qh_put()]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
drivers/usb/host/ehci-q.c
drivers/usb/host/ehci-sched.c