* [PATCH] slub: release kobject if sysfs_create_group failed in sysfs_slab_add
@ 2009-07-22 3:28 Xiaotian Feng
2009-07-22 6:17 ` Pekka Enberg
0 siblings, 1 reply; 2+ messages in thread
From: Xiaotian Feng @ 2009-07-22 3:28 UTC (permalink / raw)
To: penberg; +Cc: cl, linux-mm, linux-kernel.vger.kernel.org, Xiaotian Feng
When CONFIG_SLUB_DEBUG is enabled, sysfs_slab_add should unlink and put the
kobject if sysfs_create_group failed. Otherwise, sysfs_slab_add returns error
then free kmem_cache s, thus memory of s->kobj is leaked.
Acked-by: Christoph Lameter <cl@linux-foundation.org>
Signed-off-by: Xiaotian Feng <dfeng@redhat.com>
---
mm/slub.c | 5 ++++-
1 files changed, 4 insertions(+), 1 deletions(-)
diff --git a/mm/slub.c b/mm/slub.c
index b9f1491..f910964 100644
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -4543,8 +4543,11 @@ static int sysfs_slab_add(struct kmem_cache *s)
}
err = sysfs_create_group(&s->kobj, &slab_attr_group);
- if (err)
+ if (err) {
+ kobject_del(&s->kobj);
+ kobject_put(&s->kobj);
return err;
+ }
kobject_uevent(&s->kobj, KOBJ_ADD);
if (!unmergeable) {
/* Setup first alias */
--
1.6.2.5
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] slub: release kobject if sysfs_create_group failed in sysfs_slab_add
2009-07-22 3:28 [PATCH] slub: release kobject if sysfs_create_group failed in sysfs_slab_add Xiaotian Feng
@ 2009-07-22 6:17 ` Pekka Enberg
0 siblings, 0 replies; 2+ messages in thread
From: Pekka Enberg @ 2009-07-22 6:17 UTC (permalink / raw)
To: Xiaotian Feng; +Cc: cl, linux-mm, linux-kernel.vger.kernel.org
Xiaotian Feng wrote:
> When CONFIG_SLUB_DEBUG is enabled, sysfs_slab_add should unlink and put the
> kobject if sysfs_create_group failed. Otherwise, sysfs_slab_add returns error
> then free kmem_cache s, thus memory of s->kobj is leaked.
>
> Acked-by: Christoph Lameter <cl@linux-foundation.org>
> Signed-off-by: Xiaotian Feng <dfeng@redhat.com>
Applied, thanks!
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2009-07-22 6:21 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-07-22 3:28 [PATCH] slub: release kobject if sysfs_create_group failed in sysfs_slab_add Xiaotian Feng
2009-07-22 6:17 ` Pekka Enberg
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).