Skip to content

Commit

Permalink
USB: report submission of active URBs
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
AlanStern authored and gregkh committed Nov 12, 2012
1 parent 2656a9a commit 2f02bc8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 2 additions & 0 deletions Documentation/usb/error-codes.txt
Expand Up @@ -21,6 +21,8 @@ Non-USB-specific:

USB-specific:

-EBUSY The URB is already active.

-ENODEV specified USB-device or bus doesn't exist

-ENOENT specified interface or endpoint does not exist or
Expand Down
7 changes: 6 additions & 1 deletion drivers/usb/core/urb.c
Expand Up @@ -321,8 +321,13 @@ int usb_submit_urb(struct urb *urb, gfp_t mem_flags)
struct usb_host_endpoint *ep;
int is_out;

if (!urb || urb->hcpriv || !urb->complete)
if (!urb || !urb->complete)
return -EINVAL;
if (urb->hcpriv) {
WARN_ONCE(1, "URB %p submitted while active\n", urb);
return -EBUSY;
}

dev = urb->dev;
if ((!dev) || (dev->state < USB_STATE_UNAUTHENTICATED))
return -ENODEV;
Expand Down

0 comments on commit 2f02bc8

Please sign in to comment.