On Tue, 7 Dec 2010, Neil Jones wrote: > > But what makes sure that the URB unlinked in unlink_urbs() stays a valid pointer? > > The bottom half may run and free the URB. > > I think it may be safe to remove the lock as we are walking a list of > SKBs not URBs, > the BH can remove SKB's from the list but we are doing a safe list walk. > + the BH takse the list lock when it does the remove. > > I could be wrong though? A simple answer to Oliver's question is to take a reference to the URB while still holding the lock, then release the lock before calling usb_unlink_urb(), then drop the reference to the URB. Of course, this also requires you to restart the loop from the beginning after each unlink, and it means you need to have a way to recognize when an URB has already been unlinked. Alan Stern -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html