mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-30 03:27:44 -04:00
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 <[email protected]> Signed-off-by: Xiaotian Feng <[email protected]> Signed-off-by: Pekka Enberg <[email protected]>
This commit is contained in:
parent
acdfcd04d9
commit
5788d8ad6c
1 changed files with 4 additions and 1 deletions
|
|
@ -4593,8 +4593,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 */
|
||||
|
|
|
|||
Loading…
Reference in a new issue