Skip to content

Commit 2f02bc8

Browse files
AlanSterngregkh
authored andcommitted
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>
1 parent 2656a9a commit 2f02bc8

2 files changed

Lines changed: 8 additions & 1 deletion

File tree

‎Documentation/usb/error-codes.txt‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ Non-USB-specific:
2121

2222
USB-specific:
2323

24+
-EBUSY The URB is already active.
25+
2426
-ENODEV specified USB-device or bus doesn't exist
2527

2628
-ENOENT specified interface or endpoint does not exist or

‎drivers/usb/core/urb.c‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -321,8 +321,13 @@ int usb_submit_urb(struct urb *urb, gfp_t mem_flags)
321321
struct usb_host_endpoint *ep;
322322
int is_out;
323323

324-
if (!urb || urb->hcpriv || !urb->complete)
324+
if (!urb || !urb->complete)
325325
return -EINVAL;
326+
if (urb->hcpriv) {
327+
WARN_ONCE(1, "URB %p submitted while active\n", urb);
328+
return -EBUSY;
329+
}
330+
326331
dev = urb->dev;
327332
if ((!dev) || (dev->state < USB_STATE_UNAUTHENTICATED))
328333
return -ENODEV;

0 commit comments

Comments
 (0)