Wang Hai 757fed1d08 Revert "mm/slub: fix a memory leak in sysfs_slab_add()"
This reverts commit dde3c6b72a16c2db826f54b2d49bdea26c3534a2.

syzbot report a double-free bug. The following case can cause this bug.

 - mm/slab_common.c: create_cache(): if the __kmem_cache_create() fails,
   it does:

	out_free_cache:
		kmem_cache_free(kmem_cache, s);

 - but __kmem_cache_create() - at least for slub() - will have done

	sysfs_slab_add(s)
		-> sysfs_create_group() .. fails ..
		-> kobject_del(&s->kobj); .. which frees s ...

We can't remove the kmem_cache_free() in create_cache(), because other
error cases of __kmem_cache_create() do not free this.

So, revert the commit dde3c6b72a16 ("mm/slub: fix a memory leak in
sysfs_slab_add()") to fix this.

Reported-by: syzbot+d0bd96b4696c1ef67991@syzkaller.appspotmail.com
Fixes: dde3c6b72a16 ("mm/slub: fix a memory leak in sysfs_slab_add()")
Acked-by: Vlastimil Babka <vbabka@suse.cz>
Signed-off-by: Wang Hai <wanghai38@huawei.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2021-01-28 09:05:44 -08:00
..
2021-01-24 10:34:52 -08:00
2020-12-15 12:13:47 -08:00
2020-12-22 12:55:09 -08:00
2021-01-24 09:20:52 -08:00
2020-12-15 14:48:04 -08:00
2020-12-18 12:38:28 -08:00
2020-12-29 15:36:49 -08:00
2020-12-15 14:48:04 -08:00
2020-12-15 13:22:29 -08:00
2020-12-15 12:13:41 -08:00
2020-12-15 14:48:04 -08:00
2020-12-15 22:46:15 -08:00
2020-12-15 12:13:47 -08:00
2020-11-19 10:36:36 +01:00