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>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
e6309e7568
commit
99b28f1b41
@@ -703,9 +703,9 @@ int bus_add_driver(struct device_driver *drv)
|
|||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
out_unregister:
|
out_unregister:
|
||||||
|
kobject_put(&priv->kobj);
|
||||||
kfree(drv->p);
|
kfree(drv->p);
|
||||||
drv->p = NULL;
|
drv->p = NULL;
|
||||||
kobject_put(&priv->kobj);
|
|
||||||
out_put_bus:
|
out_put_bus:
|
||||||
bus_put(bus);
|
bus_put(bus);
|
||||||
return error;
|
return error;
|
||||||
|
Reference in New Issue
Block a user