]> git.baikalelectronics.ru Git - kernel.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)
commit9bb02f648cec139d79e273dcf36f78f991123e25
tree094f9d9449d63acb2eefed77794a27308614c8ed
parenteb424ba6e8735f843206d8d0fa84eeb681e4732d
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