================================================================== BUG: KASAN: use-after-free in filp_close+0x22/0x160 Read of size 8 at addr ffff888025434570 by task syz-executor.1/153240 CPU: 1 PID: 153240 Comm: syz-executor.1 Not tainted 5.18.0-next-20220602 #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 kasan_check_range+0xf9/0x1e0 filp_close+0x22/0x160 close_fd+0x76/0xa0 __x64_sys_close+0x2f/0xa0 do_syscall_64+0x3b/0x90 entry_SYSCALL_64_after_hwframe+0x46/0xb0 RIP: 0033:0x7f0a1c9fe72b Code: 0f 05 48 3d 00 f0 ff ff 77 45 c3 0f 1f 40 00 48 83 ec 18 89 7c 24 0c e8 63 fc ff ff 8b 7c 24 0c 41 89 c0 b8 03 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 35 44 89 c7 89 44 24 0c e8 a1 fc ff ff 8b 44 RSP: 002b:00007ffe58b4b630 EFLAGS: 00000293 ORIG_RAX: 0000000000000003 RAX: ffffffffffffffda RBX: 0000000000000007 RCX: 00007f0a1c9fe72b RDX: ffffffffffffffbc RSI: 00007f0a1c7c3d50 RDI: 0000000000000006 RBP: 0000000000000001 R08: 0000000000000000 R09: 0000001b2e02da54 R10: 00000000000011f6 R11: 0000000000000293 R12: 000000000013f362 R13: 00000000000003e8 R14: 00007f0a1cb5ef60 R15: 000000000013f309 Allocated by task 153251: 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 153241: 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+0x2cde/0x9d80 io_submit_sqes+0x1e31/0x7e50 __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 ffff888025434500 which belongs to the cache filp of size 456 The buggy address is located 112 bytes inside of 456-byte region [ffff888025434500, ffff8880254346c8) The buggy address belongs to the physical page: page:00000000d9ed7ce9 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x25434 head:00000000d9ed7ce9 order:1 compound_mapcount:0 compound_pincount:0 memcg:ffff888024071b81 flags: 0x100000000010200(slab|head|node=0|zone=1) raw: 0100000000010200 ffffea000036fb80 dead000000000002 ffff88800802f640 raw: 0000000000000000 00000000800c000c 00000001ffffffff ffff888024071b81 page dumped because: kasan: bad access detected Memory state around the buggy address: ffff888025434400: 00 00 00 00 00 00 00 00 00 fc fc fc fc fc fc fc ffff888025434480: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc >ffff888025434500: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff888025434580: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff888025434600: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ================================================================== VFS: Close: file count is 0 VFS: Close: file count is 0 UDC core: USB Raw Gadget: couldn't find an available UDC or it's busy misc raw-gadget: fail, usb_gadget_register_driver returned -16 UDC core: USB Raw Gadget: couldn't find an available UDC or it's busy misc raw-gadget: fail, usb_gadget_register_driver returned -16 VFS: Close: file count is 0 UDC core: USB Raw Gadget: couldn't find an available UDC or it's busy misc raw-gadget: fail, usb_gadget_register_driver returned -16 UDC core: USB Raw Gadget: couldn't find an available UDC or it's busy misc raw-gadget: fail, usb_gadget_register_driver returned -16 UDC core: USB Raw Gadget: couldn't find an available UDC or it's busy misc raw-gadget: fail, usb_gadget_register_driver returned -16 UDC core: USB Raw Gadget: couldn't find an available UDC or it's busy misc raw-gadget: fail, usb_gadget_register_driver returned -16 UDC core: USB Raw Gadget: couldn't find an available UDC or it's busy misc raw-gadget: fail, usb_gadget_register_driver returned -16 UDC core: USB Raw Gadget: couldn't find an available UDC or it's busy misc raw-gadget: fail, usb_gadget_register_driver returned -16 UDC core: USB Raw Gadget: couldn't find an available UDC or it's busy misc raw-gadget: fail, usb_gadget_register_driver returned -16 UDC core: USB Raw Gadget: couldn't find an available UDC or it's busy misc raw-gadget: fail, usb_gadget_register_driver returned -16 UDC core: USB Raw Gadget: couldn't find an available UDC or it's busy misc raw-gadget: fail, usb_gadget_register_driver returned -16 tmpfs: Bad value for 'mpol' UDC core: USB Raw Gadget: couldn't find an available UDC or it's busy misc raw-gadget: fail, usb_gadget_register_driver returned -16 UDC core: USB Raw Gadget: couldn't find an available UDC or it's busy misc raw-gadget: fail, usb_gadget_register_driver returned -16 UDC core: USB Raw Gadget: couldn't find an available UDC or it's busy misc raw-gadget: fail, usb_gadget_register_driver returned -16 UDC core: USB Raw Gadget: couldn't find an available UDC or it's busy misc raw-gadget: fail, usb_gadget_register_driver returned -16 UDC core: USB Raw Gadget: couldn't find an available UDC or it's busy misc raw-gadget: fail, usb_gadget_register_driver returned -16 UDC core: USB Raw Gadget: couldn't find an available UDC or it's busy misc raw-gadget: fail, usb_gadget_register_driver returned -16 UDC core: USB Raw Gadget: couldn't find an available UDC or it's busy misc raw-gadget: fail, usb_gadget_register_driver returned -16 UDC core: USB Raw Gadget: couldn't find an available UDC or it's busy misc raw-gadget: fail, usb_gadget_register_driver returned -16 UDC core: USB Raw Gadget: couldn't find an available UDC or it's busy misc raw-gadget: fail, usb_gadget_register_driver returned -16 UDC core: USB Raw Gadget: couldn't find an available UDC or it's busy misc raw-gadget: fail, usb_gadget_register_driver returned -16 netlink: 'syz-executor.6': attribute type 3 has an invalid length. UDC core: USB Raw Gadget: couldn't find an available UDC or it's busy misc raw-gadget: fail, usb_gadget_register_driver returned -16 netlink: 'syz-executor.6': attribute type 3 has an invalid length. UDC core: USB Raw Gadget: couldn't find an available UDC or it's busy misc raw-gadget: fail, usb_gadget_register_driver returned -16 netlink: 4436 bytes leftover after parsing attributes in process `syz-executor.5'. netlink: 'syz-executor.6': attribute type 3 has an invalid length. UDC core: USB Raw Gadget: couldn't find an available UDC or it's busy misc raw-gadget: fail, usb_gadget_register_driver returned -16 netlink: 'syz-executor.6': attribute type 3 has an invalid length. netlink: 4436 bytes leftover after parsing attributes in process `syz-executor.5'. UDC core: USB Raw Gadget: couldn't find an available UDC or it's busy misc raw-gadget: fail, usb_gadget_register_driver returned -16 netlink: 4436 bytes leftover after parsing attributes in process `syz-executor.5'. netlink: 4436 bytes leftover after parsing attributes in process `syz-executor.6'. UDC core: USB Raw Gadget: couldn't find an available UDC or it's busy misc raw-gadget: fail, usb_gadget_register_driver returned -16 netlink: 4436 bytes leftover after parsing attributes in process `syz-executor.5'. netlink: 4436 bytes leftover after parsing attributes in process `syz-executor.6'. UDC core: USB Raw Gadget: couldn't find an available UDC or it's busy misc raw-gadget: fail, usb_gadget_register_driver returned -16 netlink: 4436 bytes leftover after parsing attributes in process `syz-executor.6'. UDC core: USB Raw Gadget: couldn't find an available UDC or it's busy misc raw-gadget: fail, usb_gadget_register_driver returned -16 UDC core: USB Raw Gadget: couldn't find an available UDC or it's busy misc raw-gadget: fail, usb_gadget_register_driver returned -16 UDC core: USB Raw Gadget: couldn't find an available UDC or it's busy misc raw-gadget: fail, usb_gadget_register_driver returned -16 EXT4-fs: EXT4-fs: inode_readahead_blks must be 0 or a power of 2 smaller than 2^31 EXT4-fs: EXT4-fs: inode_readahead_blks must be 0 or a power of 2 smaller than 2^31