From: Stefani Seibold <stefani@seibold.net>
To: linux-kernel <linux-kernel@vger.kernel.org>
Subject: [PATCH] Fix race condition in drivers/base/dd.c
Date: Sun, 28 Feb 2010 22:31:58 +0100 [thread overview]
Message-ID: <1267392718.19716.7.camel@wall-e> (raw)
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>
---
dd.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
--- linux-2.6.33.orig/drivers/base/dd.c 2010-02-24 19:52:17.000000000 +0100
+++ linux-2.6.33/drivers/base/dd.c 2010-02-28 20:25:06.595037275 +0100
@@ -40,11 +40,11 @@ static void driver_bound(struct device *
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)
next reply other threads:[~2010-02-28 21:31 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-02-28 21:31 Stefani Seibold [this message]
-- strict thread matches above, loose matches on Subject: below --
2010-03-06 16:50 [PATCH] fix race condition in drivers/base/dd.c Stefani Seibold
2010-03-06 16:57 ` Greg KH
2010-03-06 17:15 ` Stefani Seibold
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1267392718.19716.7.camel@wall-e \
--to=stefani@seibold.net \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox