================================================================== 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:942 [inline] BUG: KASAN: slab-use-after-free in usb_anchor_suspend_wakeups+0x28/0x40 drivers/usb/core/urb.c:939 Write of size 4 at addr ffff88806c07d910 by task kworker/1:0/22 CPU: 1 PID: 22 Comm: kworker/1:0 Not tainted 6.5.0-rc7-syzkaller-g89bf6209cad6 #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 07/26/2023 Workqueue: usb_hub_wq hub_event Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0xd9/0x1b0 lib/dump_stack.c:106 print_address_description mm/kasan/report.c:364 [inline] print_report+0xc4/0x620 mm/kasan/report.c:475 kasan_report+0xda/0x110 mm/kasan/report.c:588 check_region_inline mm/kasan/generic.c:181 [inline] kasan_check_range+0xef/0x190 mm/kasan/generic.c:187 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:942 [inline] usb_anchor_suspend_wakeups+0x28/0x40 drivers/usb/core/urb.c:939 __usb_hcd_giveback_urb+0x217/0x5c0 drivers/usb/core/hcd.c:1658 usb_hcd_giveback_urb+0x389/0x430 drivers/usb/core/hcd.c:1754 dummy_timer+0x1415/0x35f0 drivers/usb/gadget/udc/dummy_hcd.c:1987 call_timer_fn+0x1a0/0x580 kernel/time/timer.c:1700 expire_timers kernel/time/timer.c:1751 [inline] __run_timers+0x764/0xb10 kernel/time/timer.c:2022 run_timer_softirq+0x58/0xd0 kernel/time/timer.c:2035 __do_softirq+0x218/0x965 kernel/softirq.c:553 invoke_softirq kernel/softirq.c:427 [inline] __irq_exit_rcu kernel/softirq.c:632 [inline] irq_exit_rcu+0xb7/0x120 kernel/softirq.c:644 sysvec_apic_timer_interrupt+0x93/0xc0 arch/x86/kernel/apic/apic.c:1109 asm_sysvec_apic_timer_interrupt+0x1a/0x20 arch/x86/include/asm/idtentry.h:645 RIP: 0010:console_flush_all+0x9b6/0xf50 kernel/printk/printk.c:2939 Code: d0 15 23 00 9c 5b 81 e3 00 02 00 00 31 ff 48 89 de e8 8e 66 1c 00 48 85 db 0f 85 94 03 00 00 e8 f0 6a 1c 00 fb 48 8b 44 24 08 <48> 8b 14 24 0f b6 00 83 e2 07 38 d0 7f 08 84 c0 0f 85 9d 04 00 00 RSP: 0018:ffffc900001c6ba8 EFLAGS: 00000293 RAX: fffff52000038da0 RBX: 0000000000000000 RCX: 0000000000000000 RDX: ffff88801727bb80 RSI: ffffffff81699db0 RDI: 0000000000000007 RBP: ffffffff8d4cafa0 R08: 0000000000000007 R09: 0000000000000000 R10: 0000000000000000 R11: 205d323254202020 R12: 0000000000000000 R13: ffffffff8d4caff8 R14: dffffc0000000000 R15: 0000000000000001 console_unlock+0xc6/0x1f0 kernel/printk/printk.c:3007 vprintk_emit+0x1c5/0x640 kernel/printk/printk.c:2307 dev_vprintk_emit drivers/base/core.c:4840 [inline] dev_printk_emit+0xfb/0x140 drivers/base/core.c:4851 __dev_printk+0xf5/0x270 drivers/base/core.c:4863 _dev_err+0xe5/0x120 drivers/base/core.c:4906 usbtmc_probe+0x1236/0x1b40 drivers/usb/class/usbtmc.c:2426 usb_probe_interface+0x307/0x930 drivers/usb/core/driver.c:396 call_driver_probe drivers/base/dd.c:579 [inline] really_probe+0x234/0xc90 drivers/base/dd.c:658 __driver_probe_device+0x1de/0x4b0 drivers/base/dd.c:798 driver_probe_device+0x4c/0x1a0 drivers/base/dd.c:828 __device_attach_driver+0x1d4/0x300 drivers/base/dd.c:956 bus_for_each_drv+0x157/0x1d0 drivers/base/bus.c:457 __device_attach+0x1e8/0x4b0 drivers/base/dd.c:1028 bus_probe_device+0x17c/0x1c0 drivers/base/bus.c:532 device_add+0x11f1/0x1b40 drivers/base/core.c:3625 usb_set_configuration+0x10cb/0x1c40 drivers/usb/core/message.c:2211 usb_generic_driver_probe+0xca/0x130 drivers/usb/core/generic.c:238 usb_probe_device+0xda/0x2c0 drivers/usb/core/driver.c:293 call_driver_probe drivers/base/dd.c:579 [inline] really_probe+0x234/0xc90 drivers/base/dd.c:658 __driver_probe_device+0x1de/0x4b0 drivers/base/dd.c:798 driver_probe_device+0x4c/0x1a0 drivers/base/dd.c:828 __device_attach_driver+0x1d4/0x300 drivers/base/dd.c:956 bus_for_each_drv+0x157/0x1d0 drivers/base/bus.c:457 __device_attach+0x1e8/0x4b0 drivers/base/dd.c:1028 bus_probe_device+0x17c/0x1c0 drivers/base/bus.c:532 device_add+0x11f1/0x1b40 drivers/base/core.c:3625 usb_new_device+0xd80/0x1960 drivers/usb/core/hub.c:2590 hub_port_connect drivers/usb/core/hub.c:5422 [inline] hub_port_connect_change drivers/usb/core/hub.c:5566 [inline] port_event drivers/usb/core/hub.c:5726 [inline] hub_event+0x307f/0x5230 drivers/usb/core/hub.c:5808 process_one_work+0xaa2/0x16f0 kernel/workqueue.c:2600 worker_thread+0x687/0x1110 kernel/workqueue.c:2751 kthread+0x33a/0x430 kernel/kthread.c:389 ret_from_fork+0x2c/0x70 arch/x86/kernel/process.c:145 ret_from_fork_asm+0x11/0x20 arch/x86/entry/entry_64.S:304 Allocated by task 6239: kasan_save_stack+0x33/0x50 mm/kasan/common.c:45 kasan_set_track+0x25/0x30 mm/kasan/common.c:52 ____kasan_kmalloc mm/kasan/common.c:374 [inline] __kasan_kmalloc+0xa2/0xb0 mm/kasan/common.c:383 kmalloc include/linux/slab.h:582 [inline] kzalloc include/linux/slab.h:703 [inline] usbtmc_open+0xa6/0x9b0 drivers/usb/class/usbtmc.c:175 usb_open+0x20f/0x2e0 drivers/usb/core/file.c:48 chrdev_open+0x277/0x700 fs/char_dev.c:414 do_dentry_open+0x88b/0x1780 fs/open.c:914 do_open fs/namei.c:3636 [inline] path_openat+0x19af/0x29c0 fs/namei.c:3793 do_filp_open+0x1de/0x430 fs/namei.c:3820 do_sys_openat2+0x176/0x1e0 fs/open.c:1407 do_sys_open fs/open.c:1422 [inline] __do_sys_openat fs/open.c:1438 [inline] __se_sys_openat fs/open.c:1433 [inline] __x64_sys_openat+0x175/0x210 fs/open.c:1433 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x38/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd Freed by task 6239: kasan_save_stack+0x33/0x50 mm/kasan/common.c:45 kasan_set_track+0x25/0x30 mm/kasan/common.c:52 kasan_save_free_info+0x2b/0x40 mm/kasan/generic.c:522 ____kasan_slab_free mm/kasan/common.c:236 [inline] ____kasan_slab_free+0x15e/0x1b0 mm/kasan/common.c:200 kasan_slab_free include/linux/kasan.h:162 [inline] slab_free_hook mm/slub.c:1792 [inline] slab_free_freelist_hook+0x10b/0x1e0 mm/slub.c:1818 slab_free mm/slub.c:3801 [inline] __kmem_cache_free+0xb8/0x2f0 mm/slub.c:3814 usbtmc_release+0x285/0x390 drivers/usb/class/usbtmc.c:261 __fput+0x3f7/0xac0 fs/file_table.c:384 task_work_run+0x14d/0x240 kernel/task_work.c:179 resume_user_mode_work include/linux/resume_user_mode.h:49 [inline] exit_to_user_mode_loop kernel/entry/common.c:171 [inline] exit_to_user_mode_prepare+0x210/0x240 kernel/entry/common.c:204 __syscall_exit_to_user_mode_work kernel/entry/common.c:286 [inline] syscall_exit_to_user_mode+0x1d/0x60 kernel/entry/common.c:297 do_syscall_64+0x44/0xb0 arch/x86/entry/common.c:86 entry_SYSCALL_64_after_hwframe+0x63/0xcd The buggy address belongs to the object at ffff88806c07d800 which belongs to the cache kmalloc-1k of size 1024 The buggy address is located 272 bytes inside of freed 1024-byte region [ffff88806c07d800, ffff88806c07dc00) The buggy address belongs to the physical page: page:ffffea0001b01e00 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x6c078 head:ffffea0001b01e00 order:3 entire_mapcount:0 nr_pages_mapped:0 pincount:0 flags: 0xfff00000010200(slab|head|node=0|zone=1|lastcpupid=0x7ff) page_type: 0xffffffff() raw: 00fff00000010200 ffff888012841dc0 ffffea0001a7a600 dead000000000002 raw: 0000000000000000 0000000000100010 00000001ffffffff 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 5481, tgid 5481 (kworker/1:7), ts 70483916087, free_ts 70063591028 set_page_owner include/linux/page_owner.h:31 [inline] post_alloc_hook+0x2d2/0x350 mm/page_alloc.c:1570 prep_new_page mm/page_alloc.c:1577 [inline] get_page_from_freelist+0x10a9/0x31e0 mm/page_alloc.c:3221 __alloc_pages+0x1d0/0x4a0 mm/page_alloc.c:4477 alloc_pages+0x1a9/0x270 mm/mempolicy.c:2292 alloc_slab_page mm/slub.c:1862 [inline] allocate_slab+0x24e/0x380 mm/slub.c:2009 new_slab mm/slub.c:2062 [inline] ___slab_alloc+0x8bc/0x1570 mm/slub.c:3215 __slab_alloc.constprop.0+0x56/0xa0 mm/slub.c:3314 __slab_alloc_node mm/slub.c:3367 [inline] slab_alloc_node mm/slub.c:3460 [inline] __kmem_cache_alloc_node+0x137/0x350 mm/slub.c:3509 __do_kmalloc_node mm/slab_common.c:984 [inline] __kmalloc+0x4c/0x100 mm/slab_common.c:998 kmalloc include/linux/slab.h:586 [inline] kzalloc include/linux/slab.h:703 [inline] ieee802_11_parse_elems_full+0xc7/0x1380 net/mac80211/util.c:1602 ieee802_11_parse_elems_crc net/mac80211/ieee80211_i.h:2327 [inline] ieee802_11_parse_elems net/mac80211/ieee80211_i.h:2334 [inline] ieee80211_rx_mgmt_probe_beacon net/mac80211/ibss.c:1609 [inline] ieee80211_ibss_rx_queued_mgmt+0xc65/0x2ee0 net/mac80211/ibss.c:1642 ieee80211_iface_process_skb net/mac80211/iface.c:1604 [inline] ieee80211_iface_work+0xa1f/0xd40 net/mac80211/iface.c:1658 cfg80211_wiphy_work+0x24e/0x330 net/wireless/core.c:435 process_one_work+0xaa2/0x16f0 kernel/workqueue.c:2600 worker_thread+0x687/0x1110 kernel/workqueue.c:2751 kthread+0x33a/0x430 kernel/kthread.c:389 page last free stack trace: reset_page_owner include/linux/page_owner.h:24 [inline] free_pages_prepare mm/page_alloc.c:1161 [inline] free_unref_page_prepare+0x508/0xb90 mm/page_alloc.c:2348 free_unref_page+0x33/0x3b0 mm/page_alloc.c:2443 __unfreeze_partials+0x21d/0x240 mm/slub.c:2647 qlink_free mm/kasan/quarantine.c:166 [inline] qlist_free_all+0x6a/0x170 mm/kasan/quarantine.c:185 kasan_quarantine_reduce+0x18b/0x1d0 mm/kasan/quarantine.c:292 __kasan_slab_alloc+0x65/0x90 mm/kasan/common.c:305 kasan_slab_alloc include/linux/kasan.h:186 [inline] slab_post_alloc_hook mm/slab.h:762 [inline] slab_alloc_node mm/slub.c:3470 [inline] slab_alloc mm/slub.c:3478 [inline] __kmem_cache_alloc_lru mm/slub.c:3485 [inline] kmem_cache_alloc+0x172/0x3b0 mm/slub.c:3494 getname_flags.part.0+0x50/0x4d0 fs/namei.c:140 getname_flags+0x9c/0xf0 include/linux/audit.h:319 vfs_fstatat+0x77/0xb0 fs/stat.c:275 __do_sys_newfstatat+0x98/0x110 fs/stat.c:446 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x38/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd Memory state around the buggy address: ffff88806c07d800: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff88806c07d880: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff88806c07d900: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff88806c07d980: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff88806c07da00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ================================================================== ---------------- Code disassembly (best guess): 0: d0 15 23 00 9c 5b rclb 0x5b9c0023(%rip) # 0x5b9c0029 6: 81 e3 00 02 00 00 and $0x200,%ebx c: 31 ff xor %edi,%edi e: 48 89 de mov %rbx,%rsi 11: e8 8e 66 1c 00 call 0x1c66a4 16: 48 85 db test %rbx,%rbx 19: 0f 85 94 03 00 00 jne 0x3b3 1f: e8 f0 6a 1c 00 call 0x1c6b14 24: fb sti 25: 48 8b 44 24 08 mov 0x8(%rsp),%rax * 2a: 48 8b 14 24 mov (%rsp),%rdx <-- trapping instruction 2e: 0f b6 00 movzbl (%rax),%eax 31: 83 e2 07 and $0x7,%edx 34: 38 d0 cmp %dl,%al 36: 7f 08 jg 0x40 38: 84 c0 test %al,%al 3a: 0f 85 9d 04 00 00 jne 0x4dd