================================================================== BUG: KASAN: use-after-free in ex_handler_refcount+0x18f/0x1c0 arch/x86/mm/extable.c:49 Write of size 4 at addr ffff88809ce3f6b8 by task syz-executor.5/15403 CPU: 0 PID: 15403 Comm: syz-executor.5 Not tainted 4.19.211-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/12/2023 Call Trace: __dump_stack lib/dump_stack.c:77 [inline] dump_stack+0x1fc/0x2ef lib/dump_stack.c:118 print_address_description.cold+0x54/0x219 mm/kasan/report.c:256 kasan_report_error.cold+0x8a/0x1b9 mm/kasan/report.c:354 kasan_report mm/kasan/report.c:412 [inline] __asan_report_store4_noabort+0x88/0x90 mm/kasan/report.c:437 ex_handler_refcount+0x18f/0x1c0 arch/x86/mm/extable.c:49 fixup_exception+0x8a/0xd0 arch/x86/mm/extable.c:197 do_trap_no_signal arch/x86/kernel/traps.c:209 [inline] do_trap+0x61/0x250 arch/x86/kernel/traps.c:258 do_error_trap+0x15d/0x310 arch/x86/kernel/traps.c:303 invalid_op+0x14/0x20 arch/x86/entry/entry_64.S:1038 RIP: 0010:__noinstr_text_end+0x392f/0x7813 Code: 01 00 00 0f 0b 48 8d 8b e8 fd ff ff 0f 0b 48 8d 8b d8 00 00 00 0f 0b 48 8d 8b b0 fe ff ff 0f 0b 48 8d 4d 38 0f 0b 48 8d 4d 38 <0f> 0b 48 8d 8d 84 00 00 00 0f 0b 48 8d 8d 84 00 00 00 0f 0b 49 8d RSP: 0018:ffff888036a0fc68 EFLAGS: 00010297 RAX: ffff8880b0da4340 RBX: 00000000ffffff01 RCX: ffff88809ce3f6b8 RDX: 0000000000000000 RSI: ffffffff852a12fa RDI: ffff88809ce3f680 RBP: ffff88809ce3f680 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000000 R12: ffffffff8a948d40 R13: ffff8880917c41c0 R14: ffff888098b9ade8 R15: ffff88809f58d000 gadgetfs_kill_sb+0x2a/0x60 drivers/usb/gadget/legacy/inode.c:2061 deactivate_locked_super+0x94/0x160 fs/super.c:329 mount_single+0x13f/0x170 fs/super.c:1232 mount_fs+0xa3/0x310 fs/super.c:1261 vfs_kern_mount.part.0+0x68/0x470 fs/namespace.c:961 vfs_kern_mount fs/namespace.c:951 [inline] do_new_mount fs/namespace.c:2492 [inline] do_mount+0x115c/0x2f50 fs/namespace.c:2822 ksys_mount+0xcf/0x130 fs/namespace.c:3038 __do_sys_mount fs/namespace.c:3052 [inline] __se_sys_mount fs/namespace.c:3049 [inline] __x64_sys_mount+0xba/0x150 fs/namespace.c:3049 do_syscall_64+0xf9/0x620 arch/x86/entry/common.c:293 entry_SYSCALL_64_after_hwframe+0x49/0xbe RIP: 0033:0x7ff18d2480c9 Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 f1 19 00 00 90 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 b8 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007ff18b799168 EFLAGS: 00000246 ORIG_RAX: 00000000000000a5 RAX: ffffffffffffffda RBX: 00007ff18d368050 RCX: 00007ff18d2480c9 RDX: 0000000020000480 RSI: 0000000020000440 RDI: 0000000000000000 RBP: 00007ff18d2a3ae9 R08: 00000000200004c0 R09: 0000000000000000 R10: 0000000000008001 R11: 0000000000000246 R12: 0000000000000000 R13: 00007ffe98379bef R14: 00007ff18b799300 R15: 0000000000022000 Allocated by task 15400: kmem_cache_alloc_trace+0x12f/0x380 mm/slab.c:3625 kmalloc include/linux/slab.h:515 [inline] kzalloc include/linux/slab.h:709 [inline] dev_new drivers/usb/gadget/legacy/inode.c:167 [inline] gadgetfs_fill_super+0x1e0/0x460 drivers/usb/gadget/legacy/inode.c:2024 mount_single+0xf1/0x170 fs/super.c:1230 mount_fs+0xa3/0x310 fs/super.c:1261 vfs_kern_mount.part.0+0x68/0x470 fs/namespace.c:961 vfs_kern_mount fs/namespace.c:951 [inline] do_new_mount fs/namespace.c:2492 [inline] do_mount+0x115c/0x2f50 fs/namespace.c:2822 ksys_mount+0xcf/0x130 fs/namespace.c:3038 __do_sys_mount fs/namespace.c:3052 [inline] __se_sys_mount fs/namespace.c:3049 [inline] __x64_sys_mount+0xba/0x150 fs/namespace.c:3049 do_syscall_64+0xf9/0x620 arch/x86/entry/common.c:293 entry_SYSCALL_64_after_hwframe+0x49/0xbe Freed by task 15400: __cache_free mm/slab.c:3503 [inline] kfree+0xcc/0x210 mm/slab.c:3822 put_dev+0x67/0x80 drivers/usb/gadget/legacy/inode.c:160 gadgetfs_kill_sb+0x2a/0x60 drivers/usb/gadget/legacy/inode.c:2061 deactivate_locked_super+0x94/0x160 fs/super.c:329 deactivate_super+0x174/0x1a0 fs/super.c:360 cleanup_mnt+0x1a8/0x290 fs/namespace.c:1098 task_work_run+0x148/0x1c0 kernel/task_work.c:113 tracehook_notify_resume include/linux/tracehook.h:193 [inline] exit_to_usermode_loop+0x251/0x2a0 arch/x86/entry/common.c:167 prepare_exit_to_usermode arch/x86/entry/common.c:198 [inline] syscall_return_slowpath arch/x86/entry/common.c:271 [inline] do_syscall_64+0x538/0x620 arch/x86/entry/common.c:296 entry_SYSCALL_64_after_hwframe+0x49/0xbe The buggy address belongs to the object at ffff88809ce3f680 which belongs to the cache kmalloc-1024 of size 1024 The buggy address is located 56 bytes inside of 1024-byte region [ffff88809ce3f680, ffff88809ce3fa80) The buggy address belongs to the page: page:ffffea0002738f80 count:1 mapcount:0 mapping:ffff88813bff0ac0 index:0xffff88809ce3f200 compound_mapcount: 0 flags: 0xfff00000008100(slab|head) raw: 00fff00000008100 ffffea0002722708 ffffea00027da788 ffff88813bff0ac0 raw: ffff88809ce3f200 ffff88809ce3e000 0000000100000006 0000000000000000 page dumped because: kasan: bad access detected Memory state around the buggy address: ffff88809ce3f580: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff88809ce3f600: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc >ffff88809ce3f680: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff88809ce3f700: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff88809ce3f780: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ==================================================================