If hcd_endpoint_disable() is called at the same time that an URB is
submitted for that endpoint, there is a nasty race.  
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.

This patch fixes the problem for UHCI.  Something equivalent is needed for 
the other HC drivers.

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

Reply via email to