linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH V2 0/1] mm/slub: release kobject if kobject_init_and_add failed in sysfs_slab_add
@ 2022-08-11  7:18 Xin Hao
  2022-08-11  7:18 ` [PATCH V2 1/1] " Xin Hao
  0 siblings, 1 reply; 5+ messages in thread
From: Xin Hao @ 2022-08-11  7:18 UTC (permalink / raw)
  To: cl
  Cc: penberg, rientjes, iamjoonsoo.kim, 42.hyeyoo, akpm, vbabka,
	roman.gushchin, linux-mm, linux-kernel

In kobject_init_and_add() function, the refcount is setted by calling
kobject_init() function, regardless of whether the return value is zero
or not, therefore, we must call kobject_del(&s->kobj) to prevent memory
of s->kobj is leaked.

V1 -> V2
use kobject_put() instead kobject_del().

V1:
https://patchwork.kernel.org/project/linux-mm/patch/20220811025258.68684-1-xhao@linux.alibaba.com/

Xin Hao (1):
  mm/slub: release kobject if kobject_init_and_add failed in
    sysfs_slab_add

 mm/slub.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

--
2.31.0


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2022-08-14 15:07 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-11  7:18 [PATCH V2 0/1] mm/slub: release kobject if kobject_init_and_add failed in sysfs_slab_add Xin Hao
2022-08-11  7:18 ` [PATCH V2 1/1] " Xin Hao
2022-08-14  8:05   ` Hyeonggon Yoo
2022-08-14 13:48     ` haoxin
2022-08-14 15:07       ` Hyeonggon Yoo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox