diff options
author | Xiaotian Feng <dfeng@redhat.com> | 2009-07-21 23:28:53 -0400 |
---|---|---|
committer | Pekka Enberg <penberg@cs.helsinki.fi> | 2009-09-03 14:11:41 -0400 |
commit | 5788d8ad6c113c589eeaaa48a173adbbe6b1cb3d (patch) | |
tree | d205f122f24be0853747be9c4d71049ed4e6d49f /mm | |
parent | acdfcd04d9df7d084ff752f82afad6ed4ad5f363 (diff) |
slub: release kobject if sysfs_create_group failed in sysfs_slab_add
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>
Signed-off-by: Pekka Enberg <penberg@cs.helsinki.fi>
Diffstat (limited to 'mm')
-rw-r--r-- | mm/slub.c | 5 |
1 files changed, 4 insertions, 1 deletions
@@ -4593,8 +4593,11 @@ static int sysfs_slab_add(struct kmem_cache *s) | |||
4593 | } | 4593 | } |
4594 | 4594 | ||
4595 | err = sysfs_create_group(&s->kobj, &slab_attr_group); | 4595 | err = sysfs_create_group(&s->kobj, &slab_attr_group); |
4596 | if (err) | 4596 | if (err) { |
4597 | kobject_del(&s->kobj); | ||
4598 | kobject_put(&s->kobj); | ||
4597 | return err; | 4599 | return err; |
4600 | } | ||
4598 | kobject_uevent(&s->kobj, KOBJ_ADD); | 4601 | kobject_uevent(&s->kobj, KOBJ_ADD); |
4599 | if (!unmergeable) { | 4602 | if (!unmergeable) { |
4600 | /* Setup first alias */ | 4603 | /* Setup first alias */ |