提交 fbb88fad 编写于 作者: S Stefani Seibold 提交者: Greg Kroah-Hartman

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: NStefani Seibold <stefani@seibold.net>
Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
上级 6f18ff91
...@@ -40,11 +40,11 @@ static void driver_bound(struct device *dev) ...@@ -40,11 +40,11 @@ static void driver_bound(struct device *dev)
pr_debug("driver: '%s': %s: bound to device '%s'\n", dev_name(dev), pr_debug("driver: '%s': %s: bound to device '%s'\n", dev_name(dev),
__func__, dev->driver->name); __func__, dev->driver->name);
klist_add_tail(&dev->p->knode_driver, &dev->driver->p->klist_devices);
if (dev->bus) if (dev->bus)
blocking_notifier_call_chain(&dev->bus->p->bus_notifier, blocking_notifier_call_chain(&dev->bus->p->bus_notifier,
BUS_NOTIFY_BOUND_DRIVER, dev); 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) static int driver_sysfs_add(struct device *dev)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册