提交 99b28f1b 编写于 作者: P Phil Carmody 提交者: Greg Kroah-Hartman

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: NPhil Carmody <ext-phil.2.carmody@nokia.com>
Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
上级 e6309e75
......@@ -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;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册