On Thu, Jun 24, 2004 at 02:42:13PM -0400, Alan Stern wrote:
> Greg:
> 
> This patch plugs a major hole in USB device locking.  Whenever a new 
> driver is loaded and the matching unbound interfaces are probed, no 
> devices are locked!  Similarly, when a driver is unloaded and its 
> interfaces are unbound, nothing is locked.
> 
> The patch fixes the problem by introducing a new rwsem and encapsulating 
> the locking procedures.  To lock a single device, the new routine 
> usb_lock_device() gets a readlock on the rwsem and a lock on the device's 
> ->serialize.  When drivers are loaded or removed, all devices are 
> effectively locked by getting a writelock on the rwsem.  The rwsem is 
> also writelocked in one other oddball circumstance: when telling the 
> driver-model core to reprobe all the unbound interfaces on a bus.
> 
> Details of the patch:
> 
>       Implement usb_lock_device(), usb_unlock_device(),
>       usb_lock_all_devices(), usb_unlock_all_devices(), and
>       usb_trylock_device().
> 
>       Call usb_(un)lock_all_devices() when registering and
>       deregistering USB drivers and when calling bus_rescan_devices().
> 
>       Convert all existing places that access usbdev->serialize
>       directly to make them call the appropriate locking routine.
> 
>       Add comments warning about the need to use the new routines,
>       and change the terminology in existing comments to talk about
>       locking a device rather than owning usbdev->serialize.
> 
>       Add proper locking to usb_find_device() and match_device(),
>       to protect against topology changes while scanning the
>       device tree.
> 
> With this change, the USB device locking model is almost complete.  There
> remains only the need for appropriate locking for routines that call
> usb_reset_device().  That patch will come next.
> 
> Please apply.

Applied, thanks.

greg k-h


-------------------------------------------------------
This SF.Net email sponsored by Black Hat Briefings & Training.
Attend Black Hat Briefings & Training, Las Vegas July 24-29 - 
digital self defense, top technical experts, no vendor pitches, 
unmatched networking opportunities. Visit www.blackhat.com
_______________________________________________
[EMAIL PROTECTED]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to