The patch titled
     Driver core: fix error handling in bus_add_driver()
has been added to the -mm tree.  Its filename is
     driver-core-fix-error-handling-in-bus_add_driver.patch

Before you just go and hit "reply", please:
   a) Consider who else should be cc'ed
   b) Prefer to cc a suitable mailing list as well
   c) Ideally: find the original patch on the mailing list and do a
      reply-to-all to that, adding suitable additional cc's

*** Remember to use Documentation/SubmitChecklist when testing your code ***

See http://www.zip.com.au/~akpm/linux/patches/stuff/added-to-mm.txt to find
out what to do about this

The current -mm tree may be found at http://userweb.kernel.org/~akpm/mmotm/

------------------------------------------------------
Subject: Driver core: fix error handling in bus_add_driver()
From: Cornelia Huck <[EMAIL PROTECTED]>

- If the allocation of ->priv fails, the reference on the bus
  must be dropped.
- If adding the kobject fails, kobject_put must be called to
  clean things up.

Signed-off-by: Cornelia Huck <[EMAIL PROTECTED]>
Cc: Kay Sievers <[EMAIL PROTECTED]>
Cc: Greg KH <[EMAIL PROTECTED]>
Signed-off-by: Andrew Morton <[EMAIL PROTECTED]>
---

 drivers/base/bus.c |    9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff -puN drivers/base/bus.c~driver-core-fix-error-handling-in-bus_add_driver 
drivers/base/bus.c
--- a/drivers/base/bus.c~driver-core-fix-error-handling-in-bus_add_driver
+++ a/drivers/base/bus.c
@@ -658,9 +658,10 @@ int bus_add_driver(struct device_driver 
        pr_debug("bus: '%s': add driver %s\n", bus->name, drv->name);
 
        priv = kzalloc(sizeof(*priv), GFP_KERNEL);
-       if (!priv)
-               return -ENOMEM;
-
+       if (!priv) {
+               error = -ENOMEM;
+               goto out_put_bus;
+       }
        klist_init(&priv->klist_devices, NULL, NULL);
        priv->driver = drv;
        drv->p = priv;
@@ -668,7 +669,7 @@ int bus_add_driver(struct device_driver 
        error = kobject_init_and_add(&priv->kobj, &driver_ktype, NULL,
                                     "%s", drv->name);
        if (error)
-               goto out_put_bus;
+               goto out_unregister;
 
        if (drv->bus->p->drivers_autoprobe) {
                error = driver_attach(drv);
_

Patches currently in -mm which might be from [EMAIL PROTECTED] are

driver-core-fix-error-handling-in-bus_add_driver.patch
git-s390.patch

-
To unsubscribe from this list: send the line "unsubscribe mm-commits" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to