Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

USB: report submission of active URBs

This patch (as1633) changes slightly the way usbcore handled
submissions of URBs that are already active. It will now return
-EBUSY rather than -EINVAL, and it will call WARN_ONCE to draw
people's attention to the bug.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Alan Stern and committed by
Greg Kroah-Hartman
2f02bc8a 2656a9ab

+8 -1
+2
Documentation/usb/error-codes.txt
··· 21 21 22 22 USB-specific: 23 23 24 + -EBUSY The URB is already active. 25 + 24 26 -ENODEV specified USB-device or bus doesn't exist 25 27 26 28 -ENOENT specified interface or endpoint does not exist or
+6 -1
drivers/usb/core/urb.c
··· 321 321 struct usb_host_endpoint *ep; 322 322 int is_out; 323 323 324 - if (!urb || urb->hcpriv || !urb->complete) 324 + if (!urb || !urb->complete) 325 325 return -EINVAL; 326 + if (urb->hcpriv) { 327 + WARN_ONCE(1, "URB %p submitted while active\n", urb); 328 + return -EBUSY; 329 + } 330 + 326 331 dev = urb->dev; 327 332 if ((!dev) || (dev->state < USB_STATE_UNAUTHENTICATED)) 328 333 return -ENODEV;