Commit 2f02bc8a authored by Alan Stern's avatar Alan Stern Committed by Greg Kroah-Hartman

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: default avatarAlan Stern <stern@rowland.harvard.edu>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 2656a9ab
...@@ -21,6 +21,8 @@ Non-USB-specific: ...@@ -21,6 +21,8 @@ Non-USB-specific:
USB-specific: USB-specific:
-EBUSY The URB is already active.
-ENODEV specified USB-device or bus doesn't exist -ENODEV specified USB-device or bus doesn't exist
-ENOENT specified interface or endpoint does not exist or -ENOENT specified interface or endpoint does not exist or
......
...@@ -321,8 +321,13 @@ int usb_submit_urb(struct urb *urb, gfp_t mem_flags) ...@@ -321,8 +321,13 @@ int usb_submit_urb(struct urb *urb, gfp_t mem_flags)
struct usb_host_endpoint *ep; struct usb_host_endpoint *ep;
int is_out; int is_out;
if (!urb || urb->hcpriv || !urb->complete) if (!urb || !urb->complete)
return -EINVAL; return -EINVAL;
if (urb->hcpriv) {
WARN_ONCE(1, "URB %p submitted while active\n", urb);
return -EBUSY;
}
dev = urb->dev; dev = urb->dev;
if ((!dev) || (dev->state < USB_STATE_UNAUTHENTICATED)) if ((!dev) || (dev->state < USB_STATE_UNAUTHENTICATED))
return -ENODEV; return -ENODEV;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment