Commit 3b6c023f authored by Martin Fuzzey's avatar Martin Fuzzey Committed by Greg Kroah-Hartman

USB: usbtest fix endless loop in unlink tests.

In tests 11 and 12 if the URB completes with an error status (eg babble)
the asynchrous unlink entered an endless loop trying to unlink
a non resubmitted URB.
Signed-off-by: default avatarMartin Fuzzey <mfuzzey@gmail.com>
Acked-by: default avatarDavid Brownell <david-b@pacbell.net>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent e60c65d3
...@@ -1072,23 +1072,34 @@ static int unlink1 (struct usbtest_dev *dev, int pipe, int size, int async) ...@@ -1072,23 +1072,34 @@ static int unlink1 (struct usbtest_dev *dev, int pipe, int size, int async)
*/ */
msleep (jiffies % (2 * INTERRUPT_RATE)); msleep (jiffies % (2 * INTERRUPT_RATE));
if (async) { if (async) {
retry: while (!completion_done(&completion)) {
retval = usb_unlink_urb (urb); retval = usb_unlink_urb(urb);
if (retval == -EBUSY || retval == -EIDRM) {
/* we can't unlink urbs while they're completing. switch (retval) {
* or if they've completed, and we haven't resubmitted. case -EBUSY:
* "normal" drivers would prevent resubmission, but case -EIDRM:
* since we're testing unlink paths, we can't. /* we can't unlink urbs while they're completing
* or if they've completed, and we haven't
* resubmitted. "normal" drivers would prevent
* resubmission, but since we're testing unlink
* paths, we can't.
*/ */
ERROR(dev, "unlink retry\n"); ERROR(dev, "unlink retry\n");
goto retry; continue;
case 0:
case -EINPROGRESS:
break;
default:
dev_err(&dev->intf->dev,
"unlink fail %d\n", retval);
return retval;
}
break;
} }
} else } else
usb_kill_urb (urb); usb_kill_urb (urb);
if (!(retval == 0 || retval == -EINPROGRESS)) {
dev_err(&dev->intf->dev, "unlink fail %d\n", retval);
return retval;
}
wait_for_completion (&completion); wait_for_completion (&completion);
retval = urb->status; retval = urb->status;
......
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