Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 122f8ec7 authored by Lin Yi's avatar Lin Yi Committed by Greg Kroah-Hartman
Browse files

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: default avatarLin Yi <teroincn@163.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 5666d896
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -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) {