usbtmc 3-1:16.0: usbtmc_read_bulk_cb - nonzero read bulk status received: -71 ================================================================== BUG: KASAN: slab-use-after-free in instrument_atomic_read_write include/linux/instrumented.h:96 [inline] BUG: KASAN: slab-use-after-free in atomic_inc include/linux/atomic/atomic-instrumented.h:435 [inline] BUG: KASAN: slab-use-after-free in usb_anchor_suspend_wakeups+0x28/0x40 drivers/usb/core/urb.c:927 Write of size 4 at addr ffff88806df65910 by task syz-executor.2/5626 CPU: 0 PID: 5626 Comm: syz-executor.2 Not tainted 6.9.0-rc5-syzkaller-00042-ge88c4cfcb7b8 #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 03/27/2024 Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0x241/0x360 lib/dump_stack.c:114 print_address_description mm/kasan/report.c:377 [inline] print_report+0x169/0x550 mm/kasan/report.c:488 kasan_report+0x143/0x180 mm/kasan/report.c:601 kasan_check_range+0x282/0x290 mm/kasan/generic.c:189 instrument_atomic_read_write include/linux/instrumented.h:96 [inline] atomic_inc include/linux/atomic/atomic-instrumented.h:435 [inline] usb_anchor_suspend_wakeups+0x28/0x40 drivers/usb/core/urb.c:927 __usb_hcd_giveback_urb+0x25c/0x530 drivers/usb/core/hcd.c:1635 dummy_timer+0x833/0x45f0 drivers/usb/gadget/udc/dummy_hcd.c:1987 call_timer_fn+0x18e/0x650 kernel/time/timer.c:1793 expire_timers kernel/time/timer.c:1844 [inline] __run_timers kernel/time/timer.c:2418 [inline] __run_timer_base+0x66a/0x8e0 kernel/time/timer.c:2429 run_timer_base kernel/time/timer.c:2438 [inline] run_timer_softirq+0xb7/0x170 kernel/time/timer.c:2448 __do_softirq+0x2c6/0x980 kernel/softirq.c:554 invoke_softirq kernel/softirq.c:428 [inline] __irq_exit_rcu+0xf2/0x1c0 kernel/softirq.c:633 irq_exit_rcu+0x9/0x30 kernel/softirq.c:645 instr_sysvec_apic_timer_interrupt arch/x86/kernel/apic/apic.c:1043 [inline] sysvec_apic_timer_interrupt+0xa6/0xc0 arch/x86/kernel/apic/apic.c:1043 asm_sysvec_apic_timer_interrupt+0x1a/0x20 arch/x86/include/asm/idtentry.h:702 RIP: 0010:__phys_addr+0x40/0x170 arch/x86/mm/physaddr.c:28 Code: 7f ff ff ff ff 4c 89 f6 e8 1d 68 53 00 4c 89 f3 48 81 eb 00 00 00 80 0f 83 94 00 00 00 48 b8 00 00 00 00 80 77 00 00 49 01 c6 <4c> 89 f7 48 89 de e8 75 65 53 00 49 39 de 0f 87 00 01 00 00 48 c7 RSP: 0018:ffffc90004ddf5f8 EFLAGS: 00000207 RAX: 0000778000000000 RBX: ffff8880ff7f2a00 RCX: ffff888011691e00 RDX: 0000000000000000 RSI: ffff88807f7f2a00 RDI: ffffffff7fffffff RBP: ffff88802314a400 R08: ffffffff81429e23 R09: ffffffff81fa7263 R10: dffffc0000000000 R11: fffffbfff25e68a6 R12: 0000000000000000 R13: ffff88807f7f2a00 R14: 000000007f7f2a00 R15: 0000000000000000 virt_to_folio include/linux/mm.h:1304 [inline] virt_to_slab mm/kasan/../slab.h:204 [inline] qlink_to_cache+0x5/0xb0 mm/kasan/quarantine.c:131 qlist_free_all+0x2e/0xc0 mm/kasan/quarantine.c:176 kasan_quarantine_reduce+0x14f/0x170 mm/kasan/quarantine.c:286 __kasan_slab_alloc+0x23/0x80 mm/kasan/common.c:322 kasan_slab_alloc include/linux/kasan.h:201 [inline] slab_post_alloc_hook mm/slub.c:3798 [inline] slab_alloc_node mm/slub.c:3845 [inline] kmalloc_trace+0x16f/0x360 mm/slub.c:3992 kmalloc include/linux/slab.h:628 [inline] kzalloc include/linux/slab.h:749 [inline] dev_new drivers/usb/gadget/legacy/raw_gadget.c:192 [inline] raw_open+0x8c/0x4d0 drivers/usb/gadget/legacy/raw_gadget.c:434 misc_open+0x313/0x390 drivers/char/misc.c:165 chrdev_open+0x5b0/0x630 fs/char_dev.c:414 do_dentry_open+0x907/0x15a0 fs/open.c:955 do_open fs/namei.c:3642 [inline] path_openat+0x2860/0x3240 fs/namei.c:3799 do_filp_open+0x235/0x490 fs/namei.c:3826 do_sys_openat2+0x13e/0x1d0 fs/open.c:1406 do_sys_open fs/open.c:1421 [inline] __do_sys_openat fs/open.c:1437 [inline] __se_sys_openat fs/open.c:1432 [inline] __x64_sys_openat+0x247/0x2a0 fs/open.c:1432 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xf5/0x240 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x77/0x7f RIP: 0033:0x7f1ad147c9a0 Code: 48 89 44 24 20 75 93 44 89 54 24 0c e8 09 82 02 00 44 8b 54 24 0c 89 da 48 89 ee 41 89 c0 bf 9c ff ff ff b8 01 01 00 00 0f 05 <48> 3d 00 f0 ff ff 77 38 44 89 c7 89 44 24 0c e8 5c 82 02 00 8b 44 RSP: 002b:00007f1ad21c0f80 EFLAGS: 00000293 ORIG_RAX: 0000000000000101 RAX: ffffffffffffffda RBX: 0000000000000002 RCX: 00007f1ad147c9a0 RDX: 0000000000000002 RSI: 00007f1ad14c949b RDI: 00000000ffffff9c RBP: 00007f1ad14c949b R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000293 R12: 0000000000000000 R13: 0000000000000024 R14: 0000000020000040 R15: 00007ffd13409f48 Allocated by task 5628: kasan_save_stack mm/kasan/common.c:47 [inline] kasan_save_track+0x3f/0x80 mm/kasan/common.c:68 poison_kmalloc_redzone mm/kasan/common.c:370 [inline] __kasan_kmalloc+0x98/0xb0 mm/kasan/common.c:387 kasan_kmalloc include/linux/kasan.h:211 [inline] kmalloc_trace+0x1db/0x360 mm/slub.c:3997 kmalloc include/linux/slab.h:628 [inline] kzalloc include/linux/slab.h:749 [inline] usbtmc_open+0x93/0x890 drivers/usb/class/usbtmc.c:175 usb_open+0x225/0x300 drivers/usb/core/file.c:47 chrdev_open+0x5b0/0x630 fs/char_dev.c:414 do_dentry_open+0x907/0x15a0 fs/open.c:955 do_open fs/namei.c:3642 [inline] path_openat+0x2860/0x3240 fs/namei.c:3799 do_filp_open+0x235/0x490 fs/namei.c:3826 do_sys_openat2+0x13e/0x1d0 fs/open.c:1406 do_sys_open fs/open.c:1421 [inline] __do_sys_openat fs/open.c:1437 [inline] __se_sys_openat fs/open.c:1432 [inline] __x64_sys_openat+0x247/0x2a0 fs/open.c:1432 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xf5/0x240 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x77/0x7f Freed by task 5628: kasan_save_stack mm/kasan/common.c:47 [inline] kasan_save_track+0x3f/0x80 mm/kasan/common.c:68 kasan_save_free_info+0x40/0x50 mm/kasan/generic.c:579 poison_slab_object+0xa6/0xe0 mm/kasan/common.c:240 __kasan_slab_free+0x37/0x60 mm/kasan/common.c:256 kasan_slab_free include/linux/kasan.h:184 [inline] slab_free_hook mm/slub.c:2106 [inline] slab_free mm/slub.c:4280 [inline] kfree+0x153/0x3a0 mm/slub.c:4390 usbtmc_release+0x24f/0x280 drivers/usb/class/usbtmc.c:261 __fput+0x429/0x8a0 fs/file_table.c:422 task_work_run+0x24f/0x310 kernel/task_work.c:180 resume_user_mode_work include/linux/resume_user_mode.h:50 [inline] exit_to_user_mode_loop kernel/entry/common.c:114 [inline] exit_to_user_mode_prepare include/linux/entry-common.h:328 [inline] __syscall_exit_to_user_mode_work kernel/entry/common.c:207 [inline] syscall_exit_to_user_mode+0x168/0x370 kernel/entry/common.c:218 do_syscall_64+0x102/0x240 arch/x86/entry/common.c:89 entry_SYSCALL_64_after_hwframe+0x77/0x7f The buggy address belongs to the object at ffff88806df65800 which belongs to the cache kmalloc-1k of size 1024 The buggy address is located 272 bytes inside of freed 1024-byte region [ffff88806df65800, ffff88806df65c00) The buggy address belongs to the physical page: page: refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x6df60 head: order:3 entire_mapcount:0 nr_pages_mapped:0 pincount:0 flags: 0xfff80000000840(slab|head|node=0|zone=1|lastcpupid=0xfff) page_type: 0xffffffff() raw: 00fff80000000840 ffff888015041dc0 dead000000000122 0000000000000000 raw: 0000000000000000 0000000000100010 00000001ffffffff 0000000000000000 head: 00fff80000000840 ffff888015041dc0 dead000000000122 0000000000000000 head: 0000000000000000 0000000000100010 00000001ffffffff 0000000000000000 head: 00fff80000000003 ffffea0001b7d801 dead000000000122 00000000ffffffff head: 0000000800000000 0000000000000000 00000000ffffffff 0000000000000000 page dumped because: kasan: bad access detected page_owner tracks the page as allocated page last allocated via order 3, migratetype Unmovable, gfp_mask 0x152820(GFP_ATOMIC|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_HARDWALL), pid 171, tgid -1898109247 (kworker/u8:6), ts 171, free_ts 96796963470 set_page_owner include/linux/page_owner.h:32 [inline] post_alloc_hook+0x1ea/0x210 mm/page_alloc.c:1534 prep_new_page mm/page_alloc.c:1541 [inline] get_page_from_freelist+0x3410/0x35b0 mm/page_alloc.c:3317 __alloc_pages+0x256/0x6c0 mm/page_alloc.c:4575 __alloc_pages_node include/linux/gfp.h:238 [inline] alloc_pages_node include/linux/gfp.h:261 [inline] alloc_slab_page+0x5f/0x160 mm/slub.c:2175 allocate_slab mm/slub.c:2338 [inline] new_slab+0x84/0x2f0 mm/slub.c:2391 ___slab_alloc+0xc73/0x1260 mm/slub.c:3525 __slab_alloc mm/slub.c:3610 [inline] __slab_alloc_node mm/slub.c:3663 [inline] slab_alloc_node mm/slub.c:3835 [inline] __do_kmalloc_node mm/slub.c:3965 [inline] __kmalloc+0x2e5/0x4a0 mm/slub.c:3979 kmalloc include/linux/slab.h:632 [inline] kzalloc include/linux/slab.h:749 [inline] ieee802_11_parse_elems_full+0xd5/0x2870 net/mac80211/parse.c:880 ieee802_11_parse_elems_crc net/mac80211/ieee80211_i.h:2325 [inline] ieee802_11_parse_elems net/mac80211/ieee80211_i.h:2332 [inline] ieee80211_inform_bss+0x15f/0x1080 net/mac80211/scan.c:79 rdev_inform_bss net/wireless/rdev-ops.h:418 [inline] cfg80211_inform_single_bss_data+0x1005/0x22e0 net/wireless/scan.c:2268 cfg80211_inform_bss_data+0x3e3/0x57d0 net/wireless/scan.c:3067 cfg80211_inform_bss_frame_data+0x3bc/0x720 net/wireless/scan.c:3157 ieee80211_bss_info_update+0x8a7/0xbc0 net/mac80211/scan.c:226 ieee80211_rx_bss_info net/mac80211/ibss.c:1099 [inline] ieee80211_rx_mgmt_probe_beacon net/mac80211/ibss.c:1578 [inline] ieee80211_ibss_rx_queued_mgmt+0x1962/0x2d70 net/mac80211/ibss.c:1605 ieee80211_iface_process_skb net/mac80211/iface.c:1605 [inline] ieee80211_iface_work+0x8a3/0xf10 net/mac80211/iface.c:1659 cfg80211_wiphy_work+0x221/0x260 net/wireless/core.c:437 page last free pid 5416 tgid 5416 stack trace: reset_page_owner include/linux/page_owner.h:25 [inline] free_pages_prepare mm/page_alloc.c:1141 [inline] free_unref_page_prepare+0x986/0xab0 mm/page_alloc.c:2347 free_unref_page+0x37/0x3f0 mm/page_alloc.c:2487 discard_slab mm/slub.c:2437 [inline] __put_partials+0xeb/0x130 mm/slub.c:2906 put_cpu_partial+0x17c/0x250 mm/slub.c:2981 __slab_free+0x2ea/0x3d0 mm/slub.c:4151 qlink_free mm/kasan/quarantine.c:163 [inline] qlist_free_all+0x5e/0xc0 mm/kasan/quarantine.c:179 kasan_quarantine_reduce+0x14f/0x170 mm/kasan/quarantine.c:286 __kasan_slab_alloc+0x23/0x80 mm/kasan/common.c:322 kasan_slab_alloc include/linux/kasan.h:201 [inline] slab_post_alloc_hook mm/slub.c:3798 [inline] slab_alloc_node mm/slub.c:3845 [inline] kmem_cache_alloc+0x174/0x340 mm/slub.c:3852 getname_flags+0xbd/0x4f0 fs/namei.c:139 do_sys_openat2+0xd2/0x1d0 fs/open.c:1400 do_sys_open fs/open.c:1421 [inline] __do_sys_openat fs/open.c:1437 [inline] __se_sys_openat fs/open.c:1432 [inline] __x64_sys_openat+0x247/0x2a0 fs/open.c:1432 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xf5/0x240 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x77/0x7f Memory state around the buggy address: ffff88806df65800: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff88806df65880: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff88806df65900: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff88806df65980: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff88806df65a00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ================================================================== ---------------- Code disassembly (best guess), 4 bytes skipped: 0: ff 4c 89 f6 decl -0xa(%rcx,%rcx,4) 4: e8 1d 68 53 00 call 0x536826 9: 4c 89 f3 mov %r14,%rbx c: 48 81 eb 00 00 00 80 sub $0xffffffff80000000,%rbx 13: 0f 83 94 00 00 00 jae 0xad 19: 48 b8 00 00 00 00 80 movabs $0x778000000000,%rax 20: 77 00 00 23: 49 01 c6 add %rax,%r14 * 26: 4c 89 f7 mov %r14,%rdi <-- trapping instruction 29: 48 89 de mov %rbx,%rsi 2c: e8 75 65 53 00 call 0x5365a6 31: 49 39 de cmp %rbx,%r14 34: 0f 87 00 01 00 00 ja 0x13a 3a: 48 rex.W 3b: c7 .byte 0xc7