powerpc: Remove double free
PATCH 1/1 powerpc: Remove double free
kfree() after kobject_put(). Who ever wrote this was on crack.
---
FTR
git log --pretty=format:"%h%x09%an%x09%ad%x09%s" | grep 7e8039795a807e8039795a80 Tobin C. Harding Tue Apr 30 11:09:23 2019 +1000 powerpc/cacheinfo: Fix kobject memleak
arch/powerpc/kernel/cacheinfo.c | 1 - 1 file changed, 1 deletion(-)
arch/powerpc/kernel/cacheinfo.c +0 -1
@@ -767,7 +767,6 @@ static void cacheinfo_create_index_dir(struct cache *cache, int index, cache_dir->kobj, "index%d", index);if (rc) {kobject_put (&index_dir->kobj); -kfree (index_dir);return ; }
Signature · 1 line
2.21.0
kobject_put() released index_dir->kobj
but who will release 'index' ?
Christophe
Le 15/05/2019 à 11:07, Tobin C. Harding a écrit :
Quoted 27 lines
kfree()afterkobject_put(). Who ever wrote this was on crack.Fixes 7e8039795a80 ("powerpc/cacheinfo: Fix kobject memleak")Signed-off-by Tobin C. Harding <[email protected]>---
FTR
git log --pretty=format:"%h%x09%an%x09%ad%x09%s" | grep
7e8039795a807e8039795a80Tobin C. Harding Tue Apr 30 11:09:23 2019 +1000 powerpc/cacheinfo: Fix kobject memleakarch/powerpc/kernel/cacheinfo.c | 1 - 1 file changed, 1 deletion(-)arch/powerpc/kernel/cacheinfo.c +0
-1@@ -767,7 +767,6 @@ static void cacheinfo_create_index_dir(struct cache *cache, int index, cache_dir->kobj, "index%d", index);if (rc) {kobject_put (&index_dir->kobj); -kfree (index_dir);return ; }
Quoted 1 line · Christophe Leroy
kobject_put()releasedindex_dir->kobj
Yes, but what is that kobject enclosed in?
Quoted 1 line
but who will release 'index' ?
The final kobject_put() will do that, see cacheinfo_create_index_dir() for the details.
And please do not top-post, you lost all context.
greg k-h
Michael Ellerman
AppliedQuoted 4 lines · Tobin C. Harding
kfree()afterkobject_put(). Who ever wrote this was on crack.Fixes 7e8039795a80 ("powerpc/cacheinfo: Fix kobject memleak")Signed-off-by Tobin C. Harding <[email protected]>
Applied to powerpc fixes, thanks.
https://git.kernel.org/powerpc/c/672eaf37db9f99fd794eed2c68a8b3b0
cheers