linux-stable/include
Alan Stern f2eaae197f Driver core: Fix potential deadlock in driver core
There is a potential deadlock in the driver core.  It boils down to
the fact that bus_remove_device() calls klist_remove() instead of
klist_del(), thereby waiting until the reference count of the
klist_node in the bus's klist of devices drops to 0.  The refcount
can't reach 0 so long as a modprobe process is trying to bind a new
driver to the device being removed, by calling __driver_attach().  The
problem is that __driver_attach() tries to acquire the device's
parent's semaphore, but the caller of bus_remove_device() is quite
likely to own that semaphore already.

It isn't sufficient just to replace klist_remove() with klist_del().
Doing so runs the risk that the device would remain on the bus's klist
of devices for some time, and so could be bound to another driver even
after it was unregistered.  What's needed is a new way to distinguish
whether or not a device is registered, based on a criterion other than
whether its klist_node is linked into the bus's klist of devices.  That
way driver binding can fail when the device is unregistered, even if
it is still linked into the klist.

This patch (as782) implements the solution, by adding a new bitflag to
indiate when a struct device is registered, by testing the flag before
allowing a driver to bind a device, and by changing the definition of
the device_is_registered() inline.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2006-09-25 21:08:40 -07:00
..
acpi
asm-alpha [libata] No need for all those arch libata-portmap.h headers 2006-09-25 15:33:09 -04:00
asm-arm Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6 2006-09-24 22:05:59 +01:00
asm-arm26 Remove ARM26 header export. 2006-09-21 08:54:44 +01:00
asm-cris Clean up exported headers on CRIS 2006-09-21 09:33:55 +01:00
asm-frv [libata] No need for all those arch libata-portmap.h headers 2006-09-25 15:33:09 -04:00
asm-generic Merge branch 'master' into upstream 2006-09-24 01:52:47 -04:00
asm-h8300 Fix H8300 exported headers. 2006-09-21 08:51:43 +01:00
asm-i386 [libata] No need for all those arch libata-portmap.h headers 2006-09-25 15:33:09 -04:00
asm-ia64 [PATCH] cpu to node relationship fixup: map cpu to node 2006-09-25 17:38:36 -07:00
asm-m32r Fix 'make headers_check' on m32r 2006-09-21 08:41:35 +01:00
asm-m68k [PATCH] Fix 'make headers_check' on ia64 2006-09-19 07:59:59 -07:00
asm-m68knommu Fix m68knommu exported headers 2006-09-21 08:50:36 +01:00
asm-mips [PATCH] headers_check: fix userspace build of asm-mips/page.h 2006-09-13 07:32:16 -07:00
asm-parisc [PATCH] headers_check: Clean up asm-parisc/page.h for user headers 2006-09-19 07:59:59 -07:00
asm-powerpc [libata] No need for all those arch libata-portmap.h headers 2006-09-25 15:33:09 -04:00
asm-ppc [PATCH] #elif that should've been #elif defined 2006-09-23 11:34:43 -07:00
asm-s390 [S390] Unexport <asm/z90crypt.h>, export <asm/zcrypt.h> in its place. 2006-09-24 22:07:25 +01:00
asm-sh Fix 'make headers_check' on sh 2006-09-21 08:36:50 +01:00
asm-sh64 Fix 'make headers_check' on sh64 2006-09-21 08:37:10 +01:00
asm-sparc [libata] No need for all those arch libata-portmap.h headers 2006-09-25 15:33:09 -04:00
asm-sparc64 [libata] No need for all those arch libata-portmap.h headers 2006-09-25 15:33:09 -04:00
asm-um Remove UML header export 2006-09-21 08:55:28 +01:00
asm-v850 Fix v850 exported headers 2006-09-21 09:05:25 +01:00
asm-x86_64 [libata] No need for all those arch libata-portmap.h headers 2006-09-25 15:33:09 -04:00
asm-xtensa
crypto [CRYPTO] digest: Added user API for new hash type 2006-09-21 11:46:17 +10:00
keys
linux Driver core: Fix potential deadlock in driver core 2006-09-25 21:08:40 -07:00
math-emu
media v4l-dev2: handle __must_check 2006-09-25 21:08:39 -07:00
mtd Merge git://git.infradead.org/~dwmw2/hdroneline 2006-09-22 12:56:22 -07:00
net [NetLabel]: rework the Netlink attribute handling (part 1) 2006-09-25 15:56:09 -07:00
pcmcia
rdma IB/sa: fix ib_sa_selector names 2006-09-22 15:22:55 -07:00
rxrpc
scsi [PATCH] SCSI gfp_t annotations 2006-09-24 20:07:49 -07:00
sound [ALSA] ak4xxx - Remove bogus IPGA controls 2006-09-23 10:46:55 +02:00
video [HEADERS] One line per header in Kbuild files to reduce conflicts 2006-09-19 12:43:58 +01:00
Kbuild [HEADERS] One line per header in Kbuild files to reduce conflicts 2006-09-19 12:43:58 +01:00