Revision 757fed1d0898b893d7daa84183947c70f27632f3 authored by Wang Hai on 28 January 2021, 11:32:50 UTC, committed by Linus Torvalds on 28 January 2021, 17:05:44 UTC
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>
1 parent 76c057c
History
File Mode Size
bnep
cmtp
hidp
rfcomm
6lowpan.c -rw-r--r-- 27.9 KB
Kconfig -rw-r--r-- 4.3 KB
Makefile -rw-r--r-- 775 bytes
a2mp.c -rw-r--r-- 21.8 KB
a2mp.h -rw-r--r-- 3.2 KB
af_bluetooth.c -rw-r--r-- 17.1 KB
amp.c -rw-r--r-- 13.8 KB
amp.h -rw-r--r-- 1.9 KB
ecdh_helper.c -rw-r--r-- 5.9 KB
ecdh_helper.h -rw-r--r-- 1.4 KB
hci_conn.c -rw-r--r-- 48.1 KB
hci_core.c -rw-r--r-- 119.7 KB
hci_debugfs.c -rw-r--r-- 30.0 KB
hci_debugfs.h -rw-r--r-- 1.6 KB
hci_event.c -rw-r--r-- 151.7 KB
hci_request.c -rw-r--r-- 88.6 KB
hci_request.h -rw-r--r-- 5.6 KB
hci_sock.c -rw-r--r-- 45.2 KB
hci_sysfs.c -rw-r--r-- 2.2 KB
l2cap_core.c -rw-r--r-- 196.9 KB
l2cap_sock.c -rw-r--r-- 41.0 KB
leds.c -rw-r--r-- 2.2 KB
leds.h -rw-r--r-- 554 bytes
lib.c -rw-r--r-- 4.0 KB
mgmt.c -rw-r--r-- 233.0 KB
mgmt_config.c -rw-r--r-- 9.3 KB
mgmt_config.h -rw-r--r-- 490 bytes
mgmt_util.c -rw-r--r-- 6.2 KB
mgmt_util.h -rw-r--r-- 2.2 KB
msft.c -rw-r--r-- 2.9 KB
msft.h -rw-r--r-- 923 bytes
sco.c -rw-r--r-- 25.6 KB
selftest.c -rw-r--r-- 8.5 KB
selftest.h -rw-r--r-- 1.6 KB
smp.c -rw-r--r-- 91.9 KB
smp.h -rw-r--r-- 5.1 KB

back to top