usbtmc 6-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 drivers/usb/core/urb.c:904 [inline] BUG: KASAN: slab-use-after-free in usb_anchor_suspend_wakeups+0x28/0x40 drivers/usb/core/urb.c:901 Write of size 4 at addr ffff88803c072110 by task syz.2.62/6969 CPU: 1 UID: 0 PID: 6969 Comm: syz.2.62 Not tainted 6.16.0-syzkaller-ga6923c06a3b2 #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:378 [inline] print_report+0xcd/0x630 mm/kasan/report.c:482 kasan_report+0xe0/0x110 mm/kasan/report.c:595 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:904 [inline] usb_anchor_suspend_wakeups+0x28/0x40 drivers/usb/core/urb.c:901 __usb_hcd_giveback_urb+0x224/0x6e0 drivers/usb/core/hcd.c:1649 usb_hcd_giveback_urb+0x39b/0x450 drivers/usb/core/hcd.c:1747 dummy_timer+0x1814/0x3a30 drivers/usb/gadget/udc/dummy_hcd.c:1995 __run_hrtimer kernel/time/hrtimer.c:1761 [inline] __hrtimer_run_queues+0x1ff/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:kernfs_get.part.0+0x3f/0x80 fs/kernfs/dir.c:537 Code: c1 ff 48 89 da 48 b8 00 00 00 00 00 fc ff df 48 c1 ea 03 0f b6 14 02 48 89 d8 83 e0 07 83 c0 03 38 d0 7c 04 84 d2 75 36 8b 2b <31> ff 89 ee e8 a8 e4 5a ff 85 ed 74 1c e8 5f e9 5a ff be 04 00 00 RSP: 0018:ffffc900037e7ca8 EFLAGS: 00000246 RAX: 0000000000000003 RBX: ffff88803115ea50 RCX: ffffffff82609ee7 RDX: 0000000000000000 RSI: 0000000000000004 RDI: ffff88803115ea50 RBP: 0000000000000001 R08: 0000000000000000 R09: ffffed100622bd4a R10: ffff88803115ea53 R11: 0000000000000000 R12: ffff88802b141940 R13: 0000000000000000 R14: dffffc0000000000 R15: ffff88802aa70cf8 kernfs_get fs/kernfs/dir.c:536 [inline] kernfs_remove_by_name_ns+0x60/0x110 fs/kernfs/dir.c:1716 driver_sysfs_remove drivers/base/dd.c:476 [inline] __device_release_driver drivers/base/dd.c:1268 [inline] device_release_driver_internal+0x415/0x620 drivers/base/dd.c:1297 driver_detach+0xd8/0x1b0 drivers/base/dd.c:1360 bus_remove_driver+0x13b/0x2c0 drivers/base/bus.c:747 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+0x402/0xb70 fs/file_table.c:468 task_work_run+0x150/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:43 exit_to_user_mode_prepare include/linux/irq-entry-common.h:225 [inline] syscall_exit_to_user_mode_work include/linux/entry-common.h:175 [inline] syscall_exit_to_user_mode include/linux/entry-common.h:210 [inline] do_syscall_64+0x3f6/0x4c0 arch/x86/entry/syscall_64.c:100 entry_SYSCALL_64_after_hwframe+0x77/0x7f RIP: 0033:0x7f296e57ff19 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:00007ffd31837b48 EFLAGS: 00000246 ORIG_RAX: 00000000000001b4 RAX: 0000000000000000 RBX: 0000000000016def RCX: 00007f296e57ff19 RDX: 0000000000000000 RSI: 000000000000001e RDI: 0000000000000003 RBP: 00007f296e747ba0 R08: 0000000000000001 R09: 00007ffd31837e2f R10: 00007f296e400000 R11: 0000000000000246 R12: 00000000000170c0 R13: 00007f296e746080 R14: 0000000000000032 R15: ffffffffffffffff Allocated by task 6970: 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+0x189/0x220 drivers/usb/core/file.c:47 chrdev_open+0x234/0x6a0 fs/char_dev.c:414 do_dentry_open+0x982/0x1530 fs/open.c:965 vfs_open+0x82/0x3f0 fs/open.c:1095 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:1435 do_sys_open fs/open.c:1450 [inline] __do_sys_openat fs/open.c:1466 [inline] __se_sys_openat fs/open.c:1461 [inline] __x64_sys_openat+0x174/0x210 fs/open.c:1461 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 6970: 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:2417 [inline] slab_free mm/slub.c:4680 [inline] kfree+0x2b4/0x4d0 mm/slub.c:4879 usbtmc_release+0x271/0x380 drivers/usb/class/usbtmc.c:261 __fput+0x402/0xb70 fs/file_table.c:468 task_work_run+0x150/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:43 exit_to_user_mode_prepare include/linux/irq-entry-common.h:225 [inline] syscall_exit_to_user_mode_work include/linux/entry-common.h:175 [inline] syscall_exit_to_user_mode include/linux/entry-common.h:210 [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 ffff88803c072000 which belongs to the cache kmalloc-1k of size 1024 The buggy address is located 272 bytes inside of freed 1024-byte region [ffff88803c072000, ffff88803c072400) The buggy address belongs to the physical page: page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x3c070 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 ffff88801b842dc0 0000000000000000 dead000000000001 raw: 0000000000000000 0000000000100010 00000000f5000000 0000000000000000 head: 00fff00000000040 ffff88801b842dc0 0000000000000000 dead000000000001 head: 0000000000000000 0000000000100010 00000000f5000000 0000000000000000 head: 00fff00000000003 ffffea0000f01c01 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 838, tgid 838 (kworker/0:2), ts 74155203212, free_ts 74140661749 set_page_owner include/linux/page_owner.h:32 [inline] post_alloc_hook+0x1c0/0x230 mm/page_alloc.c:1851 prep_new_page mm/page_alloc.c:1859 [inline] get_page_from_freelist+0x132b/0x38e0 mm/page_alloc.c:3858 __alloc_frozen_pages_noprof+0x261/0x23f0 mm/page_alloc.c:5148 alloc_pages_mpol+0x1fb/0x550 mm/mempolicy.c:2416 alloc_slab_page mm/slub.c:2487 [inline] allocate_slab mm/slub.c:2655 [inline] new_slab+0x247/0x330 mm/slub.c:2709 ___slab_alloc+0xcf2/0x1740 mm/slub.c:3891 __slab_alloc.constprop.0+0x56/0xb0 mm/slub.c:3981 __slab_alloc_node mm/slub.c:4056 [inline] slab_alloc_node mm/slub.c:4217 [inline] __do_kmalloc_node mm/slub.c:4364 [inline] __kmalloc_noprof+0x2f2/0x510 mm/slub.c:4377 kmalloc_noprof include/linux/slab.h:909 [inline] kzalloc_noprof include/linux/slab.h:1039 [inline] neigh_alloc net/core/neighbour.c:522 [inline] ___neigh_create+0x14e6/0x28c0 net/core/neighbour.c:656 ip6_finish_output2+0x1299/0x2020 net/ipv6/ip6_output.c:132 __ip6_finish_output+0x3cd/0x1010 net/ipv6/ip6_output.c:215 ip6_finish_output net/ipv6/ip6_output.c:226 [inline] NF_HOOK_COND include/linux/netfilter.h:307 [inline] ip6_output+0x1ca/0x3e0 net/ipv6/ip6_output.c:248 dst_output include/net/dst.h:461 [inline] NF_HOOK include/linux/netfilter.h:318 [inline] NF_HOOK include/linux/netfilter.h:312 [inline] mld_sendpack+0x9ea/0x1270 net/ipv6/mcast.c:1860 mld_send_cr net/ipv6/mcast.c:2159 [inline] mld_ifc_work+0x740/0xbf0 net/ipv6/mcast.c:2698 process_one_work+0x9cc/0x1b70 kernel/workqueue.c:3236 process_scheduled_works kernel/workqueue.c:3319 [inline] worker_thread+0x6c8/0xf10 kernel/workqueue.c:3400 page last free pid 10 tgid 10 stack trace: reset_page_owner include/linux/page_owner.h:25 [inline] free_pages_prepare mm/page_alloc.c:1395 [inline] __free_frozen_pages+0x7d5/0x10f0 mm/page_alloc.c:2895 discard_slab mm/slub.c:2753 [inline] __put_partials+0x165/0x1c0 mm/slub.c:3218 qlink_free mm/kasan/quarantine.c:163 [inline] qlist_free_all+0x4d/0x120 mm/kasan/quarantine.c:179 kasan_quarantine_reduce+0x195/0x1e0 mm/kasan/quarantine.c:286 __kasan_slab_alloc+0x69/0x90 mm/kasan/common.c:329 kasan_slab_alloc include/linux/kasan.h:250 [inline] slab_post_alloc_hook mm/slub.c:4180 [inline] slab_alloc_node mm/slub.c:4229 [inline] __kmalloc_cache_noprof+0x1f1/0x3e0 mm/slub.c:4391 kmalloc_noprof include/linux/slab.h:905 [inline] kzalloc_noprof include/linux/slab.h:1039 [inline] nsim_fib6_rt_create drivers/net/netdevsim/fib.c:547 [inline] nsim_fib6_rt_insert drivers/net/netdevsim/fib.c:752 [inline] nsim_fib6_event drivers/net/netdevsim/fib.c:856 [inline] nsim_fib_event drivers/net/netdevsim/fib.c:889 [inline] nsim_fib_event_work+0x17f5/0x2e80 drivers/net/netdevsim/fib.c:1493 process_one_work+0x9cc/0x1b70 kernel/workqueue.c:3236 process_scheduled_works kernel/workqueue.c:3319 [inline] worker_thread+0x6c8/0xf10 kernel/workqueue.c:3400 kthread+0x3c5/0x780 kernel/kthread.c:464 ret_from_fork+0x5d7/0x6f0 arch/x86/kernel/process.c:148 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:245 Memory state around the buggy address: ffff88803c072000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff88803c072080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff88803c072100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff88803c072180: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff88803c072200: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ================================================================== ---------------- Code disassembly (best guess): 0: c1 ff 48 sar $0x48,%edi 3: 89 da mov %ebx,%edx 5: 48 b8 00 00 00 00 00 movabs $0xdffffc0000000000,%rax c: fc ff df f: 48 c1 ea 03 shr $0x3,%rdx 13: 0f b6 14 02 movzbl (%rdx,%rax,1),%edx 17: 48 89 d8 mov %rbx,%rax 1a: 83 e0 07 and $0x7,%eax 1d: 83 c0 03 add $0x3,%eax 20: 38 d0 cmp %dl,%al 22: 7c 04 jl 0x28 24: 84 d2 test %dl,%dl 26: 75 36 jne 0x5e 28: 8b 2b mov (%rbx),%ebp * 2a: 31 ff xor %edi,%edi <-- trapping instruction 2c: 89 ee mov %ebp,%esi 2e: e8 a8 e4 5a ff call 0xff5ae4db 33: 85 ed test %ebp,%ebp 35: 74 1c je 0x53 37: e8 5f e9 5a ff call 0xff5ae99b 3c: be .byte 0xbe 3d: 04 00 add $0x0,%al