aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/misc/usbtest.c
diff options
context:
space:
mode:
authorMartin Fuzzey <mfuzzey@gmail.com>2009-06-04 17:20:38 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2009-06-16 00:44:48 -0400
commit3b6c023f831e3179c42bbcff189c73628cd5ea4c (patch)
tree491881253c6cf921e16695988efe10e2a92ebe2f /drivers/usb/misc/usbtest.c
parente60c65d35951ef3527596442338c371ea16d55ed (diff)
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: Martin Fuzzey <mfuzzey@gmail.com> Acked-by: David Brownell <david-b@pacbell.net> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb/misc/usbtest.c')
-rw-r--r--drivers/usb/misc/usbtest.c39
1 files changed, 25 insertions, 14 deletions
diff --git a/drivers/usb/misc/usbtest.c b/drivers/usb/misc/usbtest.c
index 5f1a19d1497d..a9f06d76960f 100644
--- a/drivers/usb/misc/usbtest.c
+++ b/drivers/usb/misc/usbtest.c
@@ -1072,23 +1072,34 @@ static int unlink1 (struct usbtest_dev *dev, int pipe, int size, int async)
1072 */ 1072 */
1073 msleep (jiffies % (2 * INTERRUPT_RATE)); 1073 msleep (jiffies % (2 * INTERRUPT_RATE));
1074 if (async) { 1074 if (async) {
1075retry: 1075 while (!completion_done(&completion)) {
1076 retval = usb_unlink_urb (urb); 1076 retval = usb_unlink_urb(urb);
1077 if (retval == -EBUSY || retval == -EIDRM) { 1077
1078 /* we can't unlink urbs while they're completing. 1078 switch (retval) {
1079 * or if they've completed, and we haven't resubmitted. 1079 case -EBUSY:
1080 * "normal" drivers would prevent resubmission, but 1080 case -EIDRM:
1081 * since we're testing unlink paths, we can't. 1081 /* we can't unlink urbs while they're completing
1082 */ 1082 * or if they've completed, and we haven't
1083 ERROR(dev, "unlink retry\n"); 1083 * resubmitted. "normal" drivers would prevent
1084 goto retry; 1084 * resubmission, but since we're testing unlink
1085 * paths, we can't.
1086 */
1087 ERROR(dev, "unlink retry\n");
1088 continue;
1089 case 0:
1090 case -EINPROGRESS:
1091 break;
1092
1093 default:
1094 dev_err(&dev->intf->dev,
1095 "unlink fail %d\n", retval);
1096 return retval;
1097 }
1098
1099 break;
1085 } 1100 }
1086 } else 1101 } else
1087 usb_kill_urb (urb); 1102 usb_kill_urb (urb);
1088 if (!(retval == 0 || retval == -EINPROGRESS)) {
1089 dev_err(&dev->intf->dev, "unlink fail %d\n", retval);
1090 return retval;
1091 }
1092 1103
1093 wait_for_completion (&completion); 1104 wait_for_completion (&completion);
1094 retval = urb->status; 1105 retval = urb->status;