• Alan Stern's avatar
    [PATCH] driver core: Fix races in driver_detach() · c95a6b05
    Alan Stern authored
    This patch is intended for your "driver" tree.  It fixes several subtle
    races in driver_detach() and device_release_driver() in the driver-model
    core.
    
    The major change is to use klist_remove() rather than klist_del() when
    taking a device off its driver's list.  There's no other way to guarantee
    that the list pointers will be updated before some other driver binds to
    the device.  For this to work driver_detach() can't use a klist iterator,
    so the loop over the devices must be written out in full.  In addition the
    patch protects against the possibility that, when a driver and a device
    are unregistered at the same time, one may be unloaded from memory before
    the other is finished using it.
    Signed-off-by: default avatarAlan Stern <stern@rowland.harvard.edu>
    Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
    c95a6b05
dd.c 6.07 KB