From vagabon.xyz@gmail.com Mon May 15 10:24:04 2006 Message-ID: Date: Mon, 15 May 2006 19:23:53 +0200 From: "Franck Bui-Huu" To: "David Brownell" , greg@kroah.com Subject: [PATCH] Fix a deadlock in usbtest Cc: Franck Content-Disposition: inline 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 Cc: David Brownell Signed-off-by: Greg Kroah-Hartman --- drivers/usb/misc/usbtest.c | 2 ++ 1 file changed, 2 insertions(+) --- gregkh-2.6.orig/drivers/usb/misc/usbtest.c +++ gregkh-2.6/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: