]> git.karo-electronics.de Git - karo-tx-linux.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>
Fri, 13 Aug 2010 20:31:01 +0000 (13:31 -0700)
commit8762dc2878fcdab3a3d71502c42e5923c79e8086
tree7ab01435f3e31d8eea4a1250ba20e633cc18c56e
parent733677e180eb390067ae5f53ef9ff7396aa8a07b
USB: fix thread-unsafe anchor utiliy routines

commit b3e670443b7fb8a2d29831b62b44a039c283e351 upstream.

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