summaryrefslogtreecommitdiffstats
path: root/drivers/usb
diff options
context:
space:
mode:
authorFranck Bui-Huu <vagabon.xyz@gmail.com>2006-05-15 19:23:53 +0200
committerGreg Kroah-Hartman <gregkh@suse.de>2006-06-21 15:04:12 -0700
commitcaa2a1226741e023a103e091a7f6dce7c42e82ee (patch)
tree95a9552242797efd04bd752ab5f07963d837805a /drivers/usb
parentc8155cc5d839838f8425dbea568fc537337176a7 (diff)
downloadlinux-caa2a1226741e023a103e091a7f6dce7c42e82ee.tar.gz
linux-caa2a1226741e023a103e091a7f6dce7c42e82ee.tar.bz2
linux-caa2a1226741e023a103e091a7f6dce7c42e82ee.zip
[PATCH] Fix a deadlock in usbtest
ctrl_complete functions acquires ctx->lock and tries to unlink all queued urbs in case of errors through usb_unlink_urb func. In its turn usb_unlink_urb calls, through the hcd driver, usb_hcd_giveback_urb which calls ctrl_complete again. At this time, ctx->lock is already taken by the same function. Signed-off-by: Franck Bui-Huu <vagabon.xyz@gmail.com> Cc: David Brownell <david-b@pacbell.net> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb')
-rw-r--r--drivers/usb/misc/usbtest.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/usb/misc/usbtest.c b/drivers/usb/misc/usbtest.c
index ccc5e8238bd8..b42ae6bfb12b 100644
--- a/drivers/usb/misc/usbtest.c
+++ b/drivers/usb/misc/usbtest.c
@@ -802,7 +802,9 @@ error:
if (u == urb || !u->dev)
continue;
+ spin_unlock(&ctx->lock);
status = usb_unlink_urb (u);
+ spin_lock(&ctx->lock);
switch (status) {
case -EINPROGRESS:
case -EBUSY: