================================================================== 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 drivers/usb/core/urb.c:927 [inline] BUG: KASAN: slab-use-after-free in usb_anchor_suspend_wakeups+0x28/0x40 drivers/usb/core/urb.c:924 Write of size 4 at addr ffff888054e45910 by task syz.5.765/8885 CPU: 0 UID: 0 PID: 8885 Comm: syz.5.765 Not tainted 6.15.0-syzkaller-03589-gfeacb1774bd5 #0 PREEMPT(full) Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2~bpo12+1 04/01/2014 Call Trace: __dump_stack lib/dump_stack.c:94 [inline] dump_stack_lvl+0x116/0x1f0 lib/dump_stack.c:120 print_address_description mm/kasan/report.c:408 [inline] print_report+0xcd/0x680 mm/kasan/report.c:521 kasan_report+0xe0/0x110 mm/kasan/report.c:634 check_region_inline mm/kasan/generic.c:183 [inline] kasan_check_range+0x100/0x1b0 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 drivers/usb/core/urb.c:927 [inline] usb_anchor_suspend_wakeups+0x28/0x40 drivers/usb/core/urb.c:924 __usb_hcd_giveback_urb+0x224/0x6e0 drivers/usb/core/hcd.c:1636 usb_hcd_giveback_urb+0x39b/0x450 drivers/usb/core/hcd.c:1734 dummy_timer+0x180e/0x3a20 drivers/usb/gadget/udc/dummy_hcd.c:1994 __run_hrtimer kernel/time/hrtimer.c:1761 [inline] __hrtimer_run_queues+0x202/0xad0 kernel/time/hrtimer.c:1825 hrtimer_run_softirq+0x17d/0x350 kernel/time/hrtimer.c:1842 handle_softirqs+0x216/0x8e0 kernel/softirq.c:579 __do_softirq kernel/softirq.c:613 [inline] invoke_softirq kernel/softirq.c:453 [inline] __irq_exit_rcu+0x109/0x170 kernel/softirq.c:680 irq_exit_rcu+0x9/0x30 kernel/softirq.c:696 instr_sysvec_apic_timer_interrupt arch/x86/kernel/apic/apic.c:1050 [inline] sysvec_apic_timer_interrupt+0xa4/0xc0 arch/x86/kernel/apic/apic.c:1050 asm_sysvec_apic_timer_interrupt+0x1a/0x20 arch/x86/include/asm/idtentry.h:702 RIP: 0010:orc_find arch/x86/kernel/unwind_orc.c:218 [inline] RIP: 0010:unwind_next_frame+0x23d/0x20a0 arch/x86/kernel/unwind_orc.c:494 Code: 89 74 24 20 89 44 24 18 e8 30 58 b7 00 48 8b 4c 24 30 48 8b 44 24 28 8b 74 24 20 44 8b 5c 24 18 8d 50 01 8b 0c 8d 58 28 d6 91 <48> b8 00 00 00 00 00 fc ff df 48 8d 3c 95 58 28 d6 91 49 89 f8 49 RSP: 0018:ffffc900034af8a8 EFLAGS: 00000246 RAX: 0000000000050c12 RBX: 0000000000000001 RCX: 00000000000f14a2 RDX: 0000000000050c13 RSI: 00000000000a7950 RDI: ffffffff91ea58a0 RBP: ffffc900034af960 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000050c12 R12: ffffc900034af968 R13: ffffc900034af918 R14: ffffc900034af94d R15: ffffffff860c1236 arch_stack_walk+0x94/0x100 arch/x86/kernel/stacktrace.c:25 stack_trace_save+0x8e/0xc0 kernel/stacktrace.c:122 kasan_save_stack+0x33/0x60 mm/kasan/common.c:47 kasan_record_aux_stack+0xa7/0xc0 mm/kasan/generic.c:548 __call_rcu_common.constprop.0+0x9a/0x9f0 kernel/rcu/tree.c:3090 kernfs_put.part.0+0x160/0x630 fs/kernfs/dir.c:591 kernfs_put fs/kernfs/dir.c:1721 [inline] kernfs_remove_by_name_ns+0xdf/0x110 fs/kernfs/dir.c:1715 module_remove_driver+0x57/0x250 drivers/base/module.c:101 bus_remove_driver+0x143/0x2c0 drivers/base/bus.c:748 driver_unregister+0x76/0xb0 drivers/base/driver.c:277 usb_gadget_unregister_driver+0x49/0x70 drivers/usb/gadget/udc/core.c:1732 raw_release+0x1ae/0x2b0 drivers/usb/gadget/legacy/raw_gadget.c:462 __fput+0x3ff/0xb70 fs/file_table.c:465 task_work_run+0x14d/0x240 kernel/task_work.c:227 resume_user_mode_work include/linux/resume_user_mode.h:50 [inline] exit_to_user_mode_loop+0xeb/0x110 kernel/entry/common.c:114 exit_to_user_mode_prepare include/linux/entry-common.h:330 [inline] syscall_exit_to_user_mode_work include/linux/entry-common.h:414 [inline] syscall_exit_to_user_mode include/linux/entry-common.h:449 [inline] do_syscall_64+0x3f6/0x4c0 arch/x86/entry/syscall_64.c:100 entry_SYSCALL_64_after_hwframe+0x77/0x7f RIP: 0033:0x7feba378e969 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 a8 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007feba454d038 EFLAGS: 00000246 ORIG_RAX: 00000000000001b4 RAX: 0000000000000000 RBX: 00007feba39b6160 RCX: 00007feba378e969 RDX: 0000000000000000 RSI: ffffffffffffffff RDI: 0000000000000007 RBP: 00007feba3810ab1 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 0000000000000000 R14: 00007feba39b6160 R15: 00007ffd143ca968 Allocated by task 8882: kasan_save_stack+0x33/0x60 mm/kasan/common.c:47 kasan_save_track+0x14/0x30 mm/kasan/common.c:68 poison_kmalloc_redzone mm/kasan/common.c:377 [inline] __kasan_kmalloc+0xaa/0xb0 mm/kasan/common.c:394 kmalloc_noprof include/linux/slab.h:905 [inline] kzalloc_noprof include/linux/slab.h:1039 [inline] usbtmc_open+0xa9/0x9b0 drivers/usb/class/usbtmc.c:175 usb_open+0x186/0x220 drivers/usb/core/file.c:47 chrdev_open+0x234/0x6a0 fs/char_dev.c:414 do_dentry_open+0x741/0x1c10 fs/open.c:964 vfs_open+0x82/0x3f0 fs/open.c:1094 do_open fs/namei.c:3887 [inline] path_openat+0x1de4/0x2cb0 fs/namei.c:4046 do_filp_open+0x20b/0x470 fs/namei.c:4073 do_sys_openat2+0x11b/0x1d0 fs/open.c:1437 do_sys_open fs/open.c:1452 [inline] __do_sys_openat fs/open.c:1468 [inline] __se_sys_openat fs/open.c:1463 [inline] __x64_sys_openat+0x174/0x210 fs/open.c:1463 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0xcd/0x4c0 arch/x86/entry/syscall_64.c:94 entry_SYSCALL_64_after_hwframe+0x77/0x7f Freed by task 8882: kasan_save_stack+0x33/0x60 mm/kasan/common.c:47 kasan_save_track+0x14/0x30 mm/kasan/common.c:68 kasan_save_free_info+0x3b/0x60 mm/kasan/generic.c:576 poison_slab_object mm/kasan/common.c:247 [inline] __kasan_slab_free+0x51/0x70 mm/kasan/common.c:264 kasan_slab_free include/linux/kasan.h:233 [inline] slab_free_hook mm/slub.c:2380 [inline] slab_free mm/slub.c:4642 [inline] kfree+0x2b4/0x4d0 mm/slub.c:4841 usbtmc_release+0x271/0x380 drivers/usb/class/usbtmc.c:261 __fput+0x3ff/0xb70 fs/file_table.c:465 task_work_run+0x14d/0x240 kernel/task_work.c:227 resume_user_mode_work include/linux/resume_user_mode.h:50 [inline] exit_to_user_mode_loop+0xeb/0x110 kernel/entry/common.c:114 exit_to_user_mode_prepare include/linux/entry-common.h:330 [inline] syscall_exit_to_user_mode_work include/linux/entry-common.h:414 [inline] syscall_exit_to_user_mode include/linux/entry-common.h:449 [inline] do_syscall_64+0x3f6/0x4c0 arch/x86/entry/syscall_64.c:100 entry_SYSCALL_64_after_hwframe+0x77/0x7f The buggy address belongs to the object at ffff888054e45800 which belongs to the cache kmalloc-1k of size 1024 The buggy address is located 272 bytes inside of freed 1024-byte region [ffff888054e45800, ffff888054e45c00) The buggy address belongs to the physical page: page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x54e40 head: order:3 mapcount:0 entire_mapcount:0 nr_pages_mapped:0 pincount:0 anon flags: 0xfff00000000040(head|node=0|zone=1|lastcpupid=0x7ff) page_type: f5(slab) raw: 00fff00000000040 ffff88801b442dc0 0000000000000000 dead000000000001 raw: 0000000000000000 0000000080100010 00000000f5000000 0000000000000000 head: 00fff00000000040 ffff88801b442dc0 0000000000000000 dead000000000001 head: 0000000000000000 0000000080100010 00000000f5000000 0000000000000000 head: 00fff00000000003 ffffea0001539001 00000000ffffffff 00000000ffffffff head: ffffffffffffffff 0000000000000000 00000000ffffffff 0000000000000008 page dumped because: kasan: bad access detected page_owner tracks the page as allocated page last allocated via order 3, migratetype Unmovable, gfp_mask 0x52820(GFP_ATOMIC|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP), pid 0, tgid 0 (swapper/0), ts 55299076287, free_ts 0 set_page_owner include/linux/page_owner.h:32 [inline] post_alloc_hook+0x1c0/0x230 mm/page_alloc.c:1714 prep_new_page mm/page_alloc.c:1722 [inline] get_page_from_freelist+0x135c/0x3950 mm/page_alloc.c:3684 __alloc_frozen_pages_noprof+0x261/0x23f0 mm/page_alloc.c:4974 alloc_pages_mpol+0x1fb/0x550 mm/mempolicy.c:2301 alloc_slab_page mm/slub.c:2450 [inline] allocate_slab mm/slub.c:2618 [inline] new_slab+0x23b/0x330 mm/slub.c:2672 ___slab_alloc+0xd9c/0x1940 mm/slub.c:3858 __slab_alloc.constprop.0+0x56/0xb0 mm/slub.c:3948 __slab_alloc_node mm/slub.c:4023 [inline] slab_alloc_node mm/slub.c:4184 [inline] __do_kmalloc_node mm/slub.c:4326 [inline] __kmalloc_noprof+0x2f2/0x510 mm/slub.c:4339 kmalloc_noprof include/linux/slab.h:909 [inline] kzalloc_noprof include/linux/slab.h:1039 [inline] ieee802_11_parse_elems_full+0x1d7/0x3780 net/mac80211/parse.c:1013 ieee802_11_parse_elems_crc net/mac80211/ieee80211_i.h:2402 [inline] ieee802_11_parse_elems net/mac80211/ieee80211_i.h:2409 [inline] ieee80211_inform_bss+0x10b/0x1140 net/mac80211/scan.c:79 rdev_inform_bss net/wireless/rdev-ops.h:418 [inline] cfg80211_inform_single_bss_data+0x8ea/0x1df0 net/wireless/scan.c:2367 cfg80211_inform_bss_data+0x224/0x3bc0 net/wireless/scan.c:3222 cfg80211_inform_bss_frame_data+0x26e/0x7a0 net/wireless/scan.c:3317 ieee80211_bss_info_update+0x310/0xab0 net/mac80211/scan.c:226 ieee80211_scan_rx+0x475/0xae0 net/mac80211/scan.c:340 __ieee80211_rx_handle_packet net/mac80211/rx.c:5179 [inline] ieee80211_rx_list+0x1bdb/0x2980 net/mac80211/rx.c:5416 page_owner free stack trace missing Memory state around the buggy address: ffff888054e45800: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff888054e45880: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff888054e45900: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff888054e45980: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff888054e45a00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ================================================================== ---------------- Code disassembly (best guess): 0: 89 74 24 20 mov %esi,0x20(%rsp) 4: 89 44 24 18 mov %eax,0x18(%rsp) 8: e8 30 58 b7 00 call 0xb7583d d: 48 8b 4c 24 30 mov 0x30(%rsp),%rcx 12: 48 8b 44 24 28 mov 0x28(%rsp),%rax 17: 8b 74 24 20 mov 0x20(%rsp),%esi 1b: 44 8b 5c 24 18 mov 0x18(%rsp),%r11d 20: 8d 50 01 lea 0x1(%rax),%edx 23: 8b 0c 8d 58 28 d6 91 mov -0x6e29d7a8(,%rcx,4),%ecx * 2a: 48 b8 00 00 00 00 00 movabs $0xdffffc0000000000,%rax <-- trapping instruction 31: fc ff df 34: 48 8d 3c 95 58 28 d6 lea -0x6e29d7a8(,%rdx,4),%rdi 3b: 91 3c: 49 89 f8 mov %rdi,%r8 3f: 49 rex.WB