Greg: This patch fixes a race between URB submission and endpoint-disable. (I don't know that it's actually possible to trigger the race, but it won't hurt to move the appropriate test inside the region protected by the spinlock.) In addition, an out-of-date comment referring to timeouts is removed.
The patch also changes the error code returned when an URB is submitted for a nonexistent or disabled endpoint to -ENOENT and documents the error code (which was already in use by usbfs) in Documentation/usb/error-codes.txt. Alan Stern Signed-off-by: Alan Stern <[EMAIL PROTECTED]> ===== drivers/usb/core/hcd.c 1.187 vs edited ===== --- 1.187/drivers/usb/core/hcd.c 2005-02-01 14:59:01 -05:00 +++ edited/drivers/usb/core/hcd.c 2005-02-09 10:25:58 -05:00 @@ -1083,16 +1083,9 @@ struct usb_host_endpoint *ep; unsigned long flags; - ep = (usb_pipein(urb->pipe) ? urb->dev->ep_in : urb->dev->ep_out) - [usb_pipeendpoint(urb->pipe)]; - if (!hcd || !ep) + if (!hcd) return -ENODEV; - /* - * FIXME: make urb timeouts be generic, keeping the HCD cores - * as simple as possible. - */ - usbmon_urb_submit(&hcd->self, urb); /* @@ -1104,7 +1097,11 @@ // FIXME: verify that quiescing hc works right (RH cleans up) spin_lock_irqsave (&hcd_data_lock, flags); - if (unlikely (urb->reject)) + ep = (usb_pipein(urb->pipe) ? urb->dev->ep_in : urb->dev->ep_out) + [usb_pipeendpoint(urb->pipe)]; + if (unlikely (!ep)) + status = -ENOENT; + else if (unlikely (urb->reject)) status = -EPERM; else switch (hcd->state) { case USB_STATE_RUNNING: ===== Documentation/usb/error-codes.txt 1.15 vs edited ===== --- 1.15/Documentation/usb/error-codes.txt 2005-01-18 15:22:31 -05:00 +++ edited/Documentation/usb/error-codes.txt 2005-02-09 10:29:52 -05:00 @@ -23,6 +23,9 @@ -ENODEV specified USB-device or bus doesn't exist +-ENOENT specified interface or endpoint does not exist or + is not enabled + -ENXIO host controller driver does not support queuing of this type of urb. (treat as a host controller bug.) ------------------------------------------------------- SF email is sponsored by - The IT Product Guide Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now. http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click _______________________________________________ linux-usb-devel@lists.sourceforge.net To unsubscribe, use the last form field at: https://lists.sourceforge.net/lists/listinfo/linux-usb-devel