[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Pine.LNX.4.44L0.1012071141520.1802-100000@iolanthe.rowland.org>
Date: Tue, 7 Dec 2010 11:46:32 -0500 (EST)
From: Alan Stern <stern@...land.harvard.edu>
To: Neil Jones <neiljay@...il.com>
cc: netdev@...r.kernel.org, <linux-usb@...r.kernel.org>
Subject: Re: Fwd: usbnet: Recursive Locking bug ?
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 netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists