cgroup: Unknown subsys name 'net'
cgroup: Unknown subsys name 'net_prio'
cgroup: Unknown subsys name 'devices'
cgroup: Unknown subsys name 'blkio'
=========================
WARNING: held lock freed!
5.16.0-rc3-next-20211203 #1 Not tainted
-------------------------
kworker/0:1/10 is freeing memory ffff888017ca3400-ffff888017ca35ff, with a lock still held there!
ffff888017ca3548 (&root->kernfs_rwsem){++++}-{3:3}, at: kernfs_drain fs/kernfs/dir.c:486 [inline]
ffff888017ca3548 (&root->kernfs_rwsem){++++}-{3:3}, at: __kernfs_remove+0x627/0xb00 fs/kernfs/dir.c:1361
3 locks held by kworker/0:1/10:
 #0: ffff8880080a6138 ((wq_completion)cgroup_destroy){+.+.}-{0:0}, at: arch_atomic64_set arch/x86/include/asm/atomic64_64.h:34 [inline]
 #0: ffff8880080a6138 ((wq_completion)cgroup_destroy){+.+.}-{0:0}, at: arch_atomic_long_set include/linux/atomic/atomic-long.h:41 [inline]
 #0: ffff8880080a6138 ((wq_completion)cgroup_destroy){+.+.}-{0:0}, at: atomic_long_set include/linux/atomic/atomic-instrumented.h:1198 [inline]
 #0: ffff8880080a6138 ((wq_completion)cgroup_destroy){+.+.}-{0:0}, at: set_work_data kernel/workqueue.c:635 [inline]
 #0: ffff8880080a6138 ((wq_completion)cgroup_destroy){+.+.}-{0:0}, at: set_work_pool_and_clear_pending kernel/workqueue.c:662 [inline]
 #0: ffff8880080a6138 ((wq_completion)cgroup_destroy){+.+.}-{0:0}, at: process_one_work+0x929/0x1710 kernel/workqueue.c:2289
 #1: ffff888008197da8 ((work_completion)(&(&css->destroy_rwork)->work)){+.+.}-{0:0}, at: process_one_work+0x95d/0x1710 kernel/workqueue.c:2293
 #2: ffff888017ca3548 (&root->kernfs_rwsem){++++}-{3:3}, at: kernfs_drain fs/kernfs/dir.c:486 [inline]
 #2: ffff888017ca3548 (&root->kernfs_rwsem){++++}-{3:3}, at: __kernfs_remove+0x627/0xb00 fs/kernfs/dir.c:1361

stack backtrace:
CPU: 0 PID: 10 Comm: kworker/0:1 Not tainted 5.16.0-rc3-next-20211203 #1
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.14.0-0-g155821a1990b-prebuilt.qemu.org 04/01/2014
Workqueue: cgroup_destroy css_free_rwork_fn
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0x8b/0xb3 lib/dump_stack.c:106
 print_freed_lock_bug kernel/locking/lockdep.c:6388 [inline]
 debug_check_no_locks_freed.cold+0xa5/0xb1 kernel/locking/lockdep.c:6421
 slab_free_hook mm/slub.c:1700 [inline]
 slab_free_freelist_hook mm/slub.c:1754 [inline]
 slab_free mm/slub.c:3510 [inline]
 kfree+0xb3/0x5a0 mm/slub.c:4561
 kernfs_put.part.0+0x334/0x540 fs/kernfs/dir.c:548
 kernfs_put+0x42/0x50 fs/kernfs/dir.c:513
 __kernfs_remove+0x7ce/0xb00 fs/kernfs/dir.c:1382
 kernfs_remove fs/kernfs/dir.c:1397 [inline]
 kernfs_destroy_root+0x89/0xb0 fs/kernfs/dir.c:964
 cgroup_destroy_root kernel/cgroup/cgroup.c:1374 [inline]
 css_free_rwork_fn+0xa28/0xf40 kernel/cgroup/cgroup.c:5112
 process_one_work+0xa30/0x1710 kernel/workqueue.c:2318
 worker_thread+0x62a/0x13e0 kernel/workqueue.c:2465
 kthread+0x40c/0x500 kernel/kthread.c:345
 ret_from_fork+0x22/0x30 arch/x86/entry/entry_64.S:295
 </TASK>
==================================================================
BUG: KASAN: use-after-free in __up_write kernel/locking/rwsem.c:1318 [inline]
BUG: KASAN: use-after-free in up_write+0x3ac/0x460 kernel/locking/rwsem.c:1576
Read of size 8 at addr ffff888017ca3540 by task kworker/0:1/10

CPU: 0 PID: 10 Comm: kworker/0:1 Not tainted 5.16.0-rc3-next-20211203 #1
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.14.0-0-g155821a1990b-prebuilt.qemu.org 04/01/2014
Workqueue: cgroup_destroy css_free_rwork_fn
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0x8b/0xb3 lib/dump_stack.c:106
 print_address_description.constprop.0+0x1f/0x180 mm/kasan/report.c:255
 __kasan_report mm/kasan/report.c:442 [inline]
 kasan_report.cold+0x7f/0x11b mm/kasan/report.c:459
 __up_write kernel/locking/rwsem.c:1318 [inline]
 up_write+0x3ac/0x460 kernel/locking/rwsem.c:1576
 cgroup_destroy_root kernel/cgroup/cgroup.c:1374 [inline]
 css_free_rwork_fn+0xa28/0xf40 kernel/cgroup/cgroup.c:5112
 process_one_work+0xa30/0x1710 kernel/workqueue.c:2318
 worker_thread+0x62a/0x13e0 kernel/workqueue.c:2465
 kthread+0x40c/0x500 kernel/kthread.c:345
 ret_from_fork+0x22/0x30 arch/x86/entry/entry_64.S:295
 </TASK>

Allocated by task 282:
 kasan_save_stack+0x1e/0x40 mm/kasan/common.c:38
 kasan_set_track mm/kasan/common.c:45 [inline]
 set_alloc_info mm/kasan/common.c:436 [inline]
 ____kasan_kmalloc mm/kasan/common.c:515 [inline]
 __kasan_kmalloc+0x81/0xa0 mm/kasan/common.c:524
 kmalloc include/linux/slab.h:581 [inline]
 kzalloc include/linux/slab.h:715 [inline]
 kernfs_create_root+0x4c/0x410 fs/kernfs/dir.c:913
 cgroup_setup_root+0x346/0xb60 kernel/cgroup/cgroup.c:2018
 cgroup1_root_to_use kernel/cgroup/cgroup-v1.c:1194 [inline]
 cgroup1_get_tree+0xc1b/0x1370 kernel/cgroup/cgroup-v1.c:1211
 vfs_get_tree+0x8e/0x2f0 fs/super.c:1500
 do_new_mount fs/namespace.c:3004 [inline]
 path_mount+0x131b/0x1f80 fs/namespace.c:3334
 do_mount fs/namespace.c:3347 [inline]
 __do_sys_mount fs/namespace.c:3555 [inline]
 __se_sys_mount fs/namespace.c:3532 [inline]
 __x64_sys_mount+0x27e/0x300 fs/namespace.c:3532
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x3b/0x90 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x44/0xae

Freed by task 10:
 kasan_save_stack+0x1e/0x40 mm/kasan/common.c:38
 kasan_set_track+0x21/0x30 mm/kasan/common.c:45
 kasan_set_free_info+0x20/0x30 mm/kasan/generic.c:370
 ____kasan_slab_free mm/kasan/common.c:366 [inline]
 ____kasan_slab_free mm/kasan/common.c:328 [inline]
 __kasan_slab_free+0x108/0x170 mm/kasan/common.c:374
 kasan_slab_free include/linux/kasan.h:236 [inline]
 slab_free_hook mm/slub.c:1728 [inline]
 slab_free_freelist_hook mm/slub.c:1754 [inline]
 slab_free mm/slub.c:3510 [inline]
 kfree+0xc5/0x5a0 mm/slub.c:4561
 kernfs_put.part.0+0x334/0x540 fs/kernfs/dir.c:548
 kernfs_put+0x42/0x50 fs/kernfs/dir.c:513
 __kernfs_remove+0x7ce/0xb00 fs/kernfs/dir.c:1382
 kernfs_remove fs/kernfs/dir.c:1397 [inline]
 kernfs_destroy_root+0x89/0xb0 fs/kernfs/dir.c:964
 cgroup_destroy_root kernel/cgroup/cgroup.c:1374 [inline]
 css_free_rwork_fn+0xa28/0xf40 kernel/cgroup/cgroup.c:5112
 process_one_work+0xa30/0x1710 kernel/workqueue.c:2318
 worker_thread+0x62a/0x13e0 kernel/workqueue.c:2465
 kthread+0x40c/0x500 kernel/kthread.c:345
 ret_from_fork+0x22/0x30 arch/x86/entry/entry_64.S:295

The buggy address belongs to the object at ffff888017ca3400
 which belongs to the cache kmalloc-512 of size 512
The buggy address is located 320 bytes inside of
 512-byte region [ffff888017ca3400, ffff888017ca3600)
The buggy address belongs to the page:
page:00000000dc58761c refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x17ca0
head:00000000dc58761c order:2 compound_mapcount:0 compound_pincount:0
flags: 0x100000000010200(slab|head|node=0|zone=1)
raw: 0100000000010200 0000000000000000 dead000000000122 ffff888007841c80
raw: 0000000000000000 0000000000100010 00000001ffffffff 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff888017ca3400: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff888017ca3480: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff888017ca3500: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                                           ^
 ffff888017ca3580: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff888017ca3600: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
==================================================================
cgroup: Unknown subsys name 'hugetlb'
cgroup: Unknown subsys name 'rlimit'