Skip to content

Commit

Permalink
[PATCH] Fix a deadlock in usbtest
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Franck Bui-Huu authored and Greg Kroah-Hartman committed Jun 21, 2006
1 parent c8155cc commit caa2a12
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions drivers/usb/misc/usbtest.c
Original file line number Diff line number Diff line change
Expand Up @@ -802,7 +802,9 @@ static void ctrl_complete (struct urb *urb, struct pt_regs *regs)

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:
Expand Down

0 comments on commit caa2a12

Please sign in to comment.