forked from luck/tmp_suning_uos_patched
lib : kobject: fix refcount imblance on kobject_rename
the kobj refcount increased by kobject_get should be released before error return, otherwise lead to a memory leak. Signed-off-by: Lin Yi <teroincn@163.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
5666d896e8
commit
122f8ec7b7
|
@ -498,8 +498,10 @@ int kobject_rename(struct kobject *kobj, const char *new_name)
|
|||
kobj = kobject_get(kobj);
|
||||
if (!kobj)
|
||||
return -EINVAL;
|
||||
if (!kobj->parent)
|
||||
if (!kobj->parent) {
|
||||
kobject_put(kobj);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
devpath = kobject_get_path(kobj, GFP_KERNEL);
|
||||
if (!devpath) {
|
||||
|
|
Loading…
Reference in New Issue
Block a user