================================================================== BUG: KASAN: use-after-free in ex_handler_refcount+0x164/0x1a0 arch/x86/mm/extable.c:49 Write of size 4 at addr ffff8880a6a996f8 by task syz-executor.5/17232 CPU: 0 PID: 17232 Comm: syz-executor.5 Not tainted 4.14.307-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 02/16/2023 Call Trace: __dump_stack lib/dump_stack.c:17 [inline] dump_stack+0x1b2/0x281 lib/dump_stack.c:58 print_address_description.cold+0x54/0x1d3 mm/kasan/report.c:251 kasan_report_error.cold+0x8a/0x191 mm/kasan/report.c:350 kasan_report mm/kasan/report.c:408 [inline] __asan_report_store4_noabort+0x68/0x70 mm/kasan/report.c:433 ex_handler_refcount+0x164/0x1a0 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:208 [inline] do_trap+0x61/0x250 arch/x86/kernel/traps.c:257 do_error_trap+0x132/0x2d0 arch/x86/kernel/traps.c:301 invalid_op+0x1b/0x40 arch/x86/entry/entry_64.S:967 RIP: 0010:flags_string.cold+0x2ef4/0x6c57 RSP: 0018:ffff88807b12fdb8 EFLAGS: 00010297 RAX: ffff88809bef23c0 RBX: 0000000000000001 RCX: ffff8880a6a996f8 RDX: 0000000000000000 RSI: 0000000000000001 RDI: ffff8880a6a996c0 RBP: ffff8880a6a996c0 R08: ffffffff8b9e0778 R09: 0000000000000000 R10: 0000000000000000 R11: ffff88809bef23c0 R12: ffffffff898563a0 R13: 0000000000000000 R14: 0000000000000007 R15: fffffbfff1412926 gadgetfs_kill_sb+0x2a/0x60 drivers/usb/gadget/legacy/inode.c:2085 deactivate_locked_super+0x6c/0xd0 fs/super.c:319 deactivate_super+0x7f/0xa0 fs/super.c:350 cleanup_mnt+0x186/0x2c0 fs/namespace.c:1183 task_work_run+0x11f/0x190 kernel/task_work.c:113 tracehook_notify_resume include/linux/tracehook.h:191 [inline] exit_to_usermode_loop+0x1ad/0x200 arch/x86/entry/common.c:164 prepare_exit_to_usermode arch/x86/entry/common.c:199 [inline] syscall_return_slowpath arch/x86/entry/common.c:270 [inline] do_syscall_64+0x4a3/0x640 arch/x86/entry/common.c:297 entry_SYSCALL_64_after_hwframe+0x5e/0xd3 RIP: 0033:0x7fe3ee8420f9 RSP: 002b:00007fe3ecd93168 EFLAGS: 00000246 ORIG_RAX: 00000000000000a5 RAX: ffffffffffffffec RBX: 00007fe3ee962050 RCX: 00007fe3ee8420f9 RDX: 0000000020000100 RSI: 00000000200000c0 RDI: 0000000000000000 RBP: 00007fe3ee89dae9 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 00007ffc1aad5a9f R14: 00007fe3ecd93300 R15: 0000000000022000 Allocated by task 17232: save_stack mm/kasan/kasan.c:447 [inline] set_track mm/kasan/kasan.c:459 [inline] kasan_kmalloc+0xeb/0x160 mm/kasan/kasan.c:551 kmem_cache_alloc_trace+0x131/0x3d0 mm/slab.c:3618 kmalloc include/linux/slab.h:488 [inline] kzalloc include/linux/slab.h:661 [inline] dev_new drivers/usb/gadget/legacy/inode.c:173 [inline] gadgetfs_fill_super+0x1de/0x440 drivers/usb/gadget/legacy/inode.c:2048 mount_single+0xe1/0x150 fs/super.c:1206 mount_fs+0x92/0x2a0 fs/super.c:1237 vfs_kern_mount.part.0+0x5b/0x470 fs/namespace.c:1046 vfs_kern_mount fs/namespace.c:1036 [inline] do_new_mount fs/namespace.c:2572 [inline] do_mount+0xe65/0x2a30 fs/namespace.c:2905 SYSC_mount fs/namespace.c:3121 [inline] SyS_mount+0xa8/0x120 fs/namespace.c:3098 do_syscall_64+0x1d5/0x640 arch/x86/entry/common.c:292 entry_SYSCALL_64_after_hwframe+0x5e/0xd3 Freed by task 17246: save_stack mm/kasan/kasan.c:447 [inline] set_track mm/kasan/kasan.c:459 [inline] kasan_slab_free+0xc3/0x1a0 mm/kasan/kasan.c:524 __cache_free mm/slab.c:3496 [inline] kfree+0xc9/0x250 mm/slab.c:3815 put_dev+0x59/0x70 drivers/usb/gadget/legacy/inode.c:166 gadgetfs_kill_sb+0x2a/0x60 drivers/usb/gadget/legacy/inode.c:2085 deactivate_locked_super+0x6c/0xd0 fs/super.c:319 mount_single+0x126/0x150 fs/super.c:1208 mount_fs+0x92/0x2a0 fs/super.c:1237 vfs_kern_mount.part.0+0x5b/0x470 fs/namespace.c:1046 vfs_kern_mount fs/namespace.c:1036 [inline] do_new_mount fs/namespace.c:2572 [inline] do_mount+0xe65/0x2a30 fs/namespace.c:2905 SYSC_mount fs/namespace.c:3121 [inline] SyS_mount+0xa8/0x120 fs/namespace.c:3098 do_syscall_64+0x1d5/0x640 arch/x86/entry/common.c:292 entry_SYSCALL_64_after_hwframe+0x5e/0xd3 The buggy address belongs to the object at ffff8880a6a996c0 which belongs to the cache kmalloc-1024 of size 1024 The buggy address is located 56 bytes inside of 1024-byte region [ffff8880a6a996c0, ffff8880a6a99ac0) The buggy address belongs to the page: page:ffffea00029aa600 count:1 mapcount:0 mapping:ffff8880a6a98040 index:0x0 compound_mapcount: 0 flags: 0xfff00000008100(slab|head) raw: 00fff00000008100 ffff8880a6a98040 0000000000000000 0000000100000007 raw: ffffea0002c14ba0 ffffea0002b92c20 ffff88813fe74ac0 0000000000000000 page dumped because: kasan: bad access detected Memory state around the buggy address: ffff8880a6a99580: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff8880a6a99600: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc >ffff8880a6a99680: fc fc fc fc fc fc fc fc fb fb fb fb fb fb fb fb ^ ffff8880a6a99700: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff8880a6a99780: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ==================================================================