If hcd_endpoint_disable() is called at the same time that an URB is
submitted for that endpoint, there is a nasty race.
This may be just for UHCI.
hcd_endpoint_disable() sets the endpoint maxpacket size to 0, in order to prevent further submissions. But meanwhile, the HC driver is trying to packetize the original request into maxpacket-sized packets. If maxpacket is 0, the driver will hang.
Only UHCI does packetization in software. (Except maybe for ISO.)
The other HCs do this all in hardware, it's part of the QH or ED; though they do use the maxpacket value on submit paths. They use it when the QH/ED is initialized (which is at best rare in this path); and for some "short packet" case detection when setting up TDs (which won't matter here).
Doesn't look like hangs could happen for them, and the QH/ED will get disabled immediatly in any case.
This patch fixes the problem for UHCI. Something equivalent is needed for the other HC drivers.
Ugh. The problem is that endpoint state is scattered all over the place, instead of localized in one easy-to-lock spot.
Do you have a way to reproduce this scenario, so we can verify that the other HCDs don't hang? If only UHCI needs this extra check (it's already done earlier on the submit path) I'd rather not change them.
- Dave
Alan Stern
===== uhci-hcd.c 1.59 vs edited =====
--- 1.59/drivers/usb/host/uhci-hcd.c Wed Aug 6 14:49:27 2003
+++ edited/drivers/usb/host/uhci-hcd.c Fri Aug 8 10:29:57 2003
@@ -806,6 +806,9 @@
int len = urb->transfer_buffer_length;
dma_addr_t data = urb->transfer_dma;
+ if (maxsze <= 0)
+ return -EMSGSIZE;
+
/* The "pipe" thing contains the destination in bits 8--18 */
destination = (urb->pipe & PIPE_DEVEP_MASK) | USB_PID_SETUP;
@@ -1080,6 +1083,8 @@
if (len < 0)
return -EINVAL;
+ if (maxsze <= 0)
+ return -EMSGSIZE;
/* The "pipe" thing contains the destination in bits 8--18 */
destination = (urb->pipe & PIPE_DEVEP_MASK) | usb_packetid(urb->pipe);
------------------------------------------------------- This SF.Net email sponsored by: Free pre-built ASP.NET sites including Data Reports, E-commerce, Portals, and Forums are available now. Download today and enter to win an XBOX or Visual Studio .NET. http://aspnet.click-url.com/go/psa00100003ave/direct;at.aspnet_072303_01/01 _______________________________________________ [EMAIL PROTECTED] To unsubscribe, use the last form field at: https://lists.sourceforge.net/lists/listinfo/linux-usb-devel