]> bbs.cooldavid.org Git - net-next-2.6.git/commit
USB: fix thread-unsafe anchor utiliy routines
authorChristian Lamparter <chunkeey@googlemail.com>
Tue, 3 Aug 2010 00:32:28 +0000 (02:32 +0200)
committerGreg Kroah-Hartman <gregkh@suse.de>
Tue, 10 Aug 2010 21:35:45 +0000 (14:35 -0700)
commitb3e670443b7fb8a2d29831b62b44a039c283e351
tree094f9d9449d63acb2eefed77794a27308614c8ed
parent951fd8ee6a9493f80bc5bccf2c8cfa1535c6ce15
USB: fix thread-unsafe anchor utiliy routines

This patch fixes a race condition in two utility routines
related to the removal/unlinking of urbs from an anchor.

If two threads are concurrently accessing the same anchor,
both could end up with the same urb - thinking they are
the exclusive owner.

Alan Stern pointed out a related issue in
usb_unlink_anchored_urbs:

"The URB isn't removed from the anchor until it completes
 (as a by-product of completion, in fact), which might not
 be for quite some time after the unlink call returns.
 In the meantime, the subroutine will keep trying to unlink
 it, over and over again."

Cc: stable <stable@kernel.org>
Cc: Oliver Neukum <oneukum@suse.de>
Cc: Greg Kroah-Hartman <greg@kroah.com>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Christian Lamparter <chunkeey@googlemail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/usb/core/urb.c