]> git.baikalelectronics.ru Git - kernel.git/commit
Driver core: fix race in __device_release_driver
authorAlan Stern <stern@rowland.harvard.edu>
Fri, 16 Nov 2007 16:57:28 +0000 (11:57 -0500)
committerGreg Kroah-Hartman <gregkh@suse.de>
Fri, 25 Jan 2008 04:40:35 +0000 (20:40 -0800)
commitae1da4cadad8beeef83dbf66a15da27470b85fbb
tree80aacaea0a3124713f4cff5b14e5c98c97dd6b9b
parent525620f927954d5793629b0f72e77a1430f5500b
Driver core: fix race in __device_release_driver

This patch (as1013) was suggested by David Woodhouse; it fixes a race
in the driver core.  If a device is unregistered at the same time as
its driver is unloaded, the driver's code pages may be unmapped while
the remove method is still running.  The calls to get_driver() and
put_driver() were intended to prevent this, but they don't work if the
driver's module count has already dropped to 0.

Instead, the patch keeps the device on the driver's list until after
the remove method has returned.  This forces the necessary
synchronization to occur.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/base/dd.c