2009-07-22 09:04:22

by Xiaotian Feng

[permalink] [raw]
Subject: [PATCH] slub: sysfs_slab_remove should free kmem_cache when debug is enabled

kmem_cache_destroy use sysfs_slab_remove to release the kmem_cache,
but when CONFIG_SLUB_DEBUG is enabled, sysfs_slab_remove just release
related kobject, the whole kmem_cache is missed to release and cause
a memory leak.

Signed-off-by: Xiaotian Feng <[email protected]>
---
mm/slub.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/mm/slub.c b/mm/slub.c
index b9f1491..05b69fd 100644
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -4559,6 +4559,7 @@ static void sysfs_slab_remove(struct kmem_cache *s)
kobject_uevent(&s->kobj, KOBJ_REMOVE);
kobject_del(&s->kobj);
kobject_put(&s->kobj);
+ kfree(s);
}

/*
--
1.6.2.5