summaryrefslogtreecommitdiffstats
path: root/drivers/base/bus.c
diff options
context:
space:
mode:
authorPhil Carmody <ext-phil.2.carmody@nokia.com>2009-12-14 19:28:12 +0100
committerGreg Kroah-Hartman <gregkh@suse.de>2009-12-23 20:23:44 +0100
commit99b28f1b4126582f87ce454d4affb823bddf2cd8 (patch)
treec36557d76b62d9b7b765627f569981ddb69dcfb3 /drivers/base/bus.c
parentDriver-core: Fix bogus 0 error return in device_add() (diff)
downloadlinux-99b28f1b4126582f87ce454d4affb823bddf2cd8.tar.xz
linux-99b28f1b4126582f87ce454d4affb823bddf2cd8.zip
driver core: Prevent reference to freed memory on error path
priv is drv->p. So only free drv->p after we've finished using priv. Found using a static code analysis tool Signed-off-by: Phil Carmody <ext-phil.2.carmody@nokia.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/base/bus.c')
-rw-r--r--drivers/base/bus.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/base/bus.c b/drivers/base/bus.c
index 63c143e54a57..c0c5a43d9fb3 100644
--- a/drivers/base/bus.c
+++ b/drivers/base/bus.c
@@ -703,9 +703,9 @@ int bus_add_driver(struct device_driver *drv)
return 0;
out_unregister:
+ kobject_put(&priv->kobj);
kfree(drv->p);
drv->p = NULL;
- kobject_put(&priv->kobj);
out_put_bus:
bus_put(bus);
return error;