[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <alpine.LFD.2.02.1207171035350.1650@c4eb>
Date: Tue, 17 Jul 2012 10:39:10 +0200 (CEST)
From: Sebastian Ott <sebott@...ux.vnet.ibm.com>
To: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
cc: Ming Lei <ming.lei@...onical.com>, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] driver core: move uevent call to driver_register
Hi,
On Mon, 16 Jul 2012, Greg Kroah-Hartman wrote:
> On Tue, Jul 17, 2012 at 09:35:02AM +0800, Ming Lei wrote:
> > On Tue, Jul 3, 2012 at 1:08 AM, Sebastian Ott <sebott@...ux.vnet.ibm.com> wrote:
> >
> > > --- a/drivers/base/driver.c
> > > +++ b/drivers/base/driver.c
> > > @@ -187,6 +187,9 @@ int driver_register(struct device_driver
> > > ret = driver_add_groups(drv, drv->groups);
> > > if (ret)
> > > bus_remove_driver(drv);
> > > +
> > > + kobject_uevent(&drv->p->kobj, KOBJ_ADD);
> >
> > You should just send the uevent if 'ret' equals to zero., otherwise
> > OOPS may be triggered by kobject_uevent() after the 'drv' has been
> > removed.
>
> Ugh, just missed that.
>
> Sebastian, care to send a follow-on patch for this?
Here is the follow-on. (I've also replied with an updated patch..just in
case you want to take that one).
[PATCH] driver core: don't trigger uevent after failure
Do not send the uevent if driver_add_groups failed.
Found-by: Ming Lei <ming.lei@...onical.com>
Signed-off-by: Sebastian Ott <sebott@...ux.vnet.ibm.com>
---
drivers/base/driver.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
--- a/drivers/base/driver.c
+++ b/drivers/base/driver.c
@@ -185,9 +185,10 @@ int driver_register(struct device_driver
if (ret)
return ret;
ret = driver_add_groups(drv, drv->groups);
- if (ret)
+ if (ret) {
bus_remove_driver(drv);
-
+ return ret;
+ }
kobject_uevent(&drv->p->kobj, KOBJ_ADD);
return ret;
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists