projects
/
openwrt
/
staging
/
blogic.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
5666d89
)
lib : kobject: fix refcount imblance on kobject_rename
author
Lin Yi
<teroincn@163.com>
Mon, 3 Jun 2019 08:08:10 +0000
(16:08 +0800)
committer
Greg Kroah-Hartman
<gregkh@linuxfoundation.org>
Wed, 19 Jun 2019 17:27:39 +0000
(19:27 +0200)
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>
lib/kobject.c
patch
|
blob
|
history
diff --git
a/lib/kobject.c
b/lib/kobject.c
index f2ccdbac8ed98a124a309b0d858808d706293207..83198cb37d8d93b6ac5263b16b4a9c72e5a958ef 100644
(file)
--- a/
lib/kobject.c
+++ b/
lib/kobject.c
@@
-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) {