================================================================== BUG: KASAN: use-after-free in __fget_files+0x3fe/0x440 Read of size 4 at addr ffff888046ce51fc by task syz-executor.6/11522 CPU: 1 PID: 11522 Comm: syz-executor.6 Not tainted 5.18.0-next-20220527 #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/0x5db kasan_report+0xbe/0x1c0 __fget_files+0x3fe/0x440 ksys_mmap_pgoff+0x278/0x4f0 do_syscall_64+0x3b/0x90 entry_SYSCALL_64_after_hwframe+0x46/0xb0 RIP: 0033:0x7fdbde394b19 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:00007fdbdb90a188 EFLAGS: 00000246 ORIG_RAX: 0000000000000009 RAX: ffffffffffffffda RBX: 00007fdbde4a7f60 RCX: 00007fdbde394b19 RDX: 0000000001000000 RSI: 0000000000004000 RDI: 0000000020ff5000 RBP: 00007fdbde3eef6d R08: 0000000000000006 R09: 0000000000000000 R10: 0000000000002010 R11: 0000000000000246 R12: 0000000000000000 R13: 00007ffd6d3066df R14: 00007fdbdb90a300 R15: 0000000000022000 Allocated by task 11522: kasan_save_stack+0x1e/0x40 __kasan_slab_alloc+0x66/0x80 kmem_cache_alloc+0x1aa/0x480 __alloc_file+0x21/0x230 alloc_empty_file+0x6d/0x170 path_openat+0xe1/0x2870 do_filp_open+0x1aa/0x400 do_sys_openat2+0x16d/0x4c0 __x64_sys_openat+0x13f/0x1f0 do_syscall_64+0x3b/0x90 entry_SYSCALL_64_after_hwframe+0x46/0xb0 Freed by task 11522: kasan_save_stack+0x1e/0x40 kasan_set_track+0x21/0x30 kasan_set_free_info+0x20/0x30 __kasan_slab_free+0x108/0x170 kmem_cache_free+0xe0/0x420 rcu_core+0x7e5/0x1ff0 __do_softirq+0x270/0x8c7 Last potentially related work creation: kasan_save_stack+0x1e/0x40 __kasan_record_aux_stack+0x97/0xa0 call_rcu+0x6a/0xa20 task_work_run+0xe2/0x1a0 exit_to_user_mode_prepare+0x199/0x1a0 syscall_exit_to_user_mode+0x19/0x40 do_syscall_64+0x48/0x90 entry_SYSCALL_64_after_hwframe+0x46/0xb0 Second to last potentially related work creation: kasan_save_stack+0x1e/0x40 __kasan_record_aux_stack+0x97/0xa0 task_work_add+0x3b/0x1f0 fput+0xe7/0x190 io_issue_sqe+0x2c08/0xa070 io_submit_sqes+0x1c74/0x7700 __do_sys_io_uring_enter+0x107f/0x2280 do_syscall_64+0x3b/0x90 entry_SYSCALL_64_after_hwframe+0x46/0xb0 The buggy address belongs to the object at ffff888046ce5180 which belongs to the cache filp of size 456 The buggy address is located 124 bytes inside of 456-byte region [ffff888046ce5180, ffff888046ce5348) The buggy address belongs to the physical page: page:000000004e396310 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x46ce4 head:000000004e396310 order:1 compound_mapcount:0 compound_pincount:0 memcg:ffff888037741101 flags: 0x100000000010200(slab|head|node=0|zone=1) raw: 0100000000010200 ffffea0001274f00 dead000000000004 ffff88800802a500 raw: 0000000000000000 00000000000c000c 00000001ffffffff ffff888037741101 page dumped because: kasan: bad access detected Memory state around the buggy address: ffff888046ce5080: fb fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc ffff888046ce5100: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc >ffff888046ce5180: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff888046ce5200: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff888046ce5280: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ================================================================== VFS: Close: file count is 0