==================================================================
BUG: KASAN: use-after-free in __kernfs_remove+0x9dd/0xb30
Read of size 2 at addr ffff88803da02b78 by task syz-executor.2/32737
CPU: 1 PID: 32737 Comm: syz-executor.2 Not tainted 6.0.0-rc2-next-20220824 #1
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.14.0-0-g155821a1990b-prebuilt.qemu.org 04/01/2014
Call Trace:
dump_stack_lvl+0x8b/0xb3
print_report.cold+0x5e/0x5e5
kasan_report+0xb1/0x1c0
__kernfs_remove+0x9dd/0xb30
kernfs_remove_by_name_ns+0xa8/0x110
sysfs_slab_add+0x142/0x1f0
__kmem_cache_create+0x46e/0x5d0
kmem_cache_create_usercopy+0x1fd/0x2e0
p9_client_create+0xc85/0x1050
v9fs_session_init+0x1dd/0x1670
v9fs_mount+0xb9/0xbd0
legacy_get_tree+0x105/0x220
vfs_get_tree+0x8e/0x300
path_mount+0x1310/0x1e20
__x64_sys_mount+0x282/0x300
do_syscall_64+0x3b/0x90
entry_SYSCALL_64_after_hwframe+0x63/0xcd
RIP: 0033:0x7f268eed9b19
Code: ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 bc ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007f268c44f188 EFLAGS: 00000246 ORIG_RAX: 00000000000000a5
RAX: ffffffffffffffda RBX: 00007f268efecf60 RCX: 00007f268eed9b19
RDX: 0000000020000100 RSI: 00000000200000c0 RDI: 0000000000000000
RBP: 00007f268ef33f6d R08: 00000000200001c0 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 00007fff096756cf R14: 00007f268c44f300 R15: 0000000000022000
Allocated by task 32732:
kasan_save_stack+0x1e/0x40
__kasan_slab_alloc+0x66/0x80
kmem_cache_alloc+0x1b1/0x3e0
__kernfs_new_node+0xd4/0x8c0
kernfs_create_dir_ns+0x9c/0x230
sysfs_create_dir_ns+0x127/0x290
kobject_add_internal+0x24c/0x8e0
kobject_init_and_add+0x101/0x160
sysfs_slab_add+0x165/0x1f0
__kmem_cache_create+0x46e/0x5d0
kmem_cache_create_usercopy+0x1fd/0x2e0
p9_client_create+0xc85/0x1050
v9fs_session_init+0x1dd/0x1670
v9fs_mount+0xb9/0xbd0
legacy_get_tree+0x105/0x220
vfs_get_tree+0x8e/0x300
path_mount+0x1310/0x1e20
__x64_sys_mount+0x282/0x300
do_syscall_64+0x3b/0x90
entry_SYSCALL_64_after_hwframe+0x63/0xcd
Freed by task 32737:
kasan_save_stack+0x1e/0x40
kasan_set_track+0x21/0x30
kasan_set_free_info+0x20/0x40
__kasan_slab_free+0x108/0x190
kmem_cache_free+0xf7/0x610
kernfs_put.part.0+0x2c7/0x540
kernfs_put+0x42/0x50
__kernfs_remove+0x7d4/0xb30
kernfs_remove_by_name_ns+0xa8/0x110
sysfs_slab_add+0x142/0x1f0
__kmem_cache_create+0x46e/0x5d0
kmem_cache_create_usercopy+0x1fd/0x2e0
p9_client_create+0xc85/0x1050
v9fs_session_init+0x1dd/0x1670
v9fs_mount+0xb9/0xbd0
legacy_get_tree+0x105/0x220
vfs_get_tree+0x8e/0x300
path_mount+0x1310/0x1e20
__x64_sys_mount+0x282/0x300
do_syscall_64+0x3b/0x90
entry_SYSCALL_64_after_hwframe+0x63/0xcd
The buggy address belongs to the object at ffff88803da02ae0
which belongs to the cache kernfs_node_cache of size 168
The buggy address is located 152 bytes inside of
168-byte region [ffff88803da02ae0, ffff88803da02b88)
The buggy address belongs to the physical page:
page:00000000271216d4 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x3da02
flags: 0x100000000000200(slab|node=0|zone=1)
raw: 0100000000000200 0000000000000000 dead000000000122 ffff88800843d8c0
raw: 0000000000000000 0000000000110011 00000001ffffffff 0000000000000000
page dumped because: kasan: bad access detected
Memory state around the buggy address:
ffff88803da02a00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff88803da02a80: fb fb fb fb fc fc fc fc fc fc fc fc fa fb fb fb
>ffff88803da02b00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
^
ffff88803da02b80: fb fc fc fc fc fc fc fc fc fa fb fb fb fb fb fb
ffff88803da02c00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fc fc
==================================================================
------------[ cut here ]------------
WARNING: CPU: 1 PID: 32737 at fs/kernfs/dir.c:504 kernfs_get.part.0+0x6d/0x80
Modules linked in:
CPU: 1 PID: 32737 Comm: syz-executor.2 Tainted: G B 6.0.0-rc2-next-20220824 #1
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.14.0-0-g155821a1990b-prebuilt.qemu.org 04/01/2014
RIP: 0010:kernfs_get.part.0+0x6d/0x80
Code: e8 88 ec a6 ff 85 ed 74 1c e8 cf ef a6 ff be 04 00 00 00 48 89 df e8 82 d3 d9 ff f0 ff 03 5b 5d e9 28 87 c1 02 e8 b3 ef a6 ff <0f> 0b eb db 48 89 df e8 f7 cf d9 ff eb c2 0f 1f 44 00 00 55 48 89
RSP: 0018:ffff88803b02f780 EFLAGS: 00010246
RAX: 0000000000040000 RBX: ffff88803da02ae0 RCX: ffffc900051f0000
RDX: 0000000000040000 RSI: ffffffff819eb39d RDI: 0000000000000005
RBP: 0000000000000000 R08: 0000000000000005 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000001 R12: 0000000000000000
R13: dffffc0000000000 R14: ffff88804fb1a2f8 R15: ffff88803da02ae0
FS: 00007f268c44f700(0000) GS:ffff88806cf00000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007f061330b718 CR3: 000000004e7dc000 CR4: 0000000000350ee0
Call Trace:
__kernfs_remove+0x34a/0xb30
kernfs_remove_by_name_ns+0xa8/0x110
sysfs_slab_add+0x142/0x1f0
__kmem_cache_create+0x46e/0x5d0
kmem_cache_create_usercopy+0x1fd/0x2e0
p9_client_create+0xc85/0x1050
v9fs_session_init+0x1dd/0x1670
v9fs_mount+0xb9/0xbd0
legacy_get_tree+0x105/0x220
vfs_get_tree+0x8e/0x300
path_mount+0x1310/0x1e20
__x64_sys_mount+0x282/0x300
do_syscall_64+0x3b/0x90
entry_SYSCALL_64_after_hwframe+0x63/0xcd
RIP: 0033:0x7f268eed9b19
Code: ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 bc ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007f268c44f188 EFLAGS: 00000246 ORIG_RAX: 00000000000000a5
RAX: ffffffffffffffda RBX: 00007f268efecf60 RCX: 00007f268eed9b19
RDX: 0000000020000100 RSI: 00000000200000c0 RDI: 0000000000000000
RBP: 00007f268ef33f6d R08: 00000000200001c0 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 00007fff096756cf R14: 00007f268c44f300 R15: 0000000000022000
irq event stamp: 949
hardirqs last enabled at (949): [] asm_sysvec_apic_timer_interrupt+0x16/0x20
hardirqs last disabled at (948): [] __do_softirq+0x6be/0x8d0
softirqs last enabled at (868): [] __irq_exit_rcu+0x11b/0x180
softirqs last disabled at (857): [] __irq_exit_rcu+0x11b/0x180
---[ end trace 0000000000000000 ]---
------------[ cut here ]------------
WARNING: CPU: 1 PID: 32737 at fs/kernfs/dir.c:473 __kernfs_remove+0x982/0xb30
Modules linked in:
CPU: 1 PID: 32737 Comm: syz-executor.2 Tainted: G B W 6.0.0-rc2-next-20220824 #1
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.14.0-0-g155821a1990b-prebuilt.qemu.org 04/01/2014
RIP: 0010:__kernfs_remove+0x982/0xb30
Code: 80 3c 28 00 0f 85 f9 00 00 00 49 83 6c 24 68 01 4c 8b 63 30 e9 5f fd ff ff 48 8b 9d 28 ff ff ff e9 c0 f9 ff ff e8 2e c5 a6 ff <0f> 0b e9 bc fa ff ff e8 22 c5 a6 ff 4c 89 e2 48 b8 00 00 00 00 00
RSP: 0018:ffff88803b02f798 EFLAGS: 00010246
RAX: 0000000000040000 RBX: ffff88803da02ae0 RCX: ffffc900051f0000
RDX: 0000000000040000 RSI: ffffffff819ede22 RDI: 0000000000000001
RBP: ffff88803b02f8c8 R08: 0000000000000001 R09: 0000000000000000
R10: 0000000000000001 R11: 0000000000000001 R12: 0000000000000001
R13: dffffc0000000000 R14: ffff88804fb1a2f8 R15: ffff888007c5b400
FS: 00007f268c44f700(0000) GS:ffff88806cf00000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007f061330b718 CR3: 000000004e7dc000 CR4: 0000000000350ee0
Call Trace:
kernfs_remove_by_name_ns+0xa8/0x110
sysfs_slab_add+0x142/0x1f0
__kmem_cache_create+0x46e/0x5d0
kmem_cache_create_usercopy+0x1fd/0x2e0
p9_client_create+0xc85/0x1050
v9fs_session_init+0x1dd/0x1670
v9fs_mount+0xb9/0xbd0
legacy_get_tree+0x105/0x220
vfs_get_tree+0x8e/0x300
path_mount+0x1310/0x1e20
__x64_sys_mount+0x282/0x300
do_syscall_64+0x3b/0x90
entry_SYSCALL_64_after_hwframe+0x63/0xcd
RIP: 0033:0x7f268eed9b19
Code: ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 bc ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007f268c44f188 EFLAGS: 00000246 ORIG_RAX: 00000000000000a5
RAX: ffffffffffffffda RBX: 00007f268efecf60 RCX: 00007f268eed9b19
RDX: 0000000020000100 RSI: 00000000200000c0 RDI: 0000000000000000
RBP: 00007f268ef33f6d R08: 00000000200001c0 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 00007fff096756cf R14: 00007f268c44f300 R15: 0000000000022000
irq event stamp: 949
hardirqs last enabled at (949): [] asm_sysvec_apic_timer_interrupt+0x16/0x20
hardirqs last disabled at (948): [] __do_softirq+0x6be/0x8d0
softirqs last enabled at (868): [] __irq_exit_rcu+0x11b/0x180
softirqs last disabled at (857): [] __irq_exit_rcu+0x11b/0x180
---[ end trace 0000000000000000 ]---