summaryrefslogtreecommitdiffstats
path: root/drivers/base/dd.c
diff options
context:
space:
mode:
authorStefani Seibold <stefani@seibold.net>2010-03-06 17:50:14 +0100
committerGreg Kroah-Hartman <gregkh@suse.de>2010-05-21 09:37:29 -0700
commitfbb88fadf7dc2dd6d0d1aa88ff521b2f8552996a (patch)
treeaf4979113cb3b7fbd8fdbba5cad35a7cb185e9b3 /drivers/base/dd.c
parent6f18ff91d926ab411749a199b06a49f6bc72e9af (diff)
downloadop-kernel-dev-fbb88fadf7dc2dd6d0d1aa88ff521b2f8552996a.zip
op-kernel-dev-fbb88fadf7dc2dd6d0d1aa88ff521b2f8552996a.tar.gz
driver-core: fix potential race condition in drivers/base/dd.c
This patch fix a potential race condition in the driver_bound() function in the file driver/base/dd.c. The broadcast of the BUS_NOTIFY_BOUND_DRIVER notifier should be done after adding the new device to the driver list. Otherwise notifier listener will fail if they use functions like usb_find_interface(). The patch is against kernel 2.6.33. Please merge it. Signed-off-by: Stefani Seibold <stefani@seibold.net> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/base/dd.c')
-rw-r--r--drivers/base/dd.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/base/dd.c b/drivers/base/dd.c
index c89291f..503c262 100644
--- a/drivers/base/dd.c
+++ b/drivers/base/dd.c
@@ -40,11 +40,11 @@ static void driver_bound(struct device *dev)
pr_debug("driver: '%s': %s: bound to device '%s'\n", dev_name(dev),
__func__, dev->driver->name);
+ klist_add_tail(&dev->p->knode_driver, &dev->driver->p->klist_devices);
+
if (dev->bus)
blocking_notifier_call_chain(&dev->bus->p->bus_notifier,
BUS_NOTIFY_BOUND_DRIVER, dev);
-
- klist_add_tail(&dev->p->knode_driver, &dev->driver->p->klist_devices);
}
static int driver_sysfs_add(struct device *dev)
OpenPOWER on IntegriCloud