================================================================== BUG: KASAN: use-after-free in __list_add_valid+0x6a/0xf0 lib/list_debug.c:30 Read of size 8 at addr ffff88811243cc60 by task kworker/1:13/3763 CPU: 1 PID: 3763 Comm: kworker/1:13 Tainted: G W 5.10.210-syzkaller-00394-g70b6ab09a34b #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 03/27/2024 Workqueue: events uhid_device_add_worker Call Trace: __dump_stack lib/dump_stack.c:77 [inline] dump_stack_lvl+0x1e2/0x24b lib/dump_stack.c:118 print_address_description+0x81/0x3b0 mm/kasan/report.c:248 __kasan_report mm/kasan/report.c:435 [inline] kasan_report+0x179/0x1c0 mm/kasan/report.c:452 __asan_report_load8_noabort+0x14/0x20 mm/kasan/report_generic.c:309 __list_add_valid+0x6a/0xf0 lib/list_debug.c:30 __list_add include/linux/list.h:67 [inline] list_add_tail include/linux/list.h:100 [inline] insert_work+0x107/0x310 kernel/workqueue.c:1356 __queue_work+0x970/0xd10 kernel/workqueue.c:1518 queue_work_on+0x105/0x160 kernel/workqueue.c:1545 wg_queue_enqueue_per_device_and_peer drivers/net/wireguard/queueing.h:189 [inline] wg_packet_create_data drivers/net/wireguard/send.c:320 [inline] wg_packet_send_staged_packets+0xe26/0x1440 drivers/net/wireguard/send.c:387 wg_packet_send_keepalive+0x15e/0x1c0 drivers/net/wireguard/send.c:239 wg_expired_send_persistent_keepalive+0x53/0x80 drivers/net/wireguard/timers.c:141 call_timer_fn+0x3b/0x2d0 kernel/time/timer.c:1420 expire_timers kernel/time/timer.c:1465 [inline] __run_timers+0x72a/0xa10 kernel/time/timer.c:1759 run_timer_softirq+0x69/0xf0 kernel/time/timer.c:1772 __do_softirq+0x268/0x5bb kernel/softirq.c:309 asm_call_irq_on_stack+0xf/0x20 __run_on_irqstack arch/x86/include/asm/irq_stack.h:26 [inline] run_on_irqstack_cond arch/x86/include/asm/irq_stack.h:77 [inline] do_softirq_own_stack+0x60/0x80 arch/x86/kernel/irq_64.c:77 invoke_softirq kernel/softirq.c:405 [inline] __irq_exit_rcu+0x128/0x150 kernel/softirq.c:435 irq_exit_rcu+0x9/0x10 kernel/softirq.c:447 sysvec_apic_timer_interrupt+0xbf/0xe0 arch/x86/kernel/apic/apic.c:1094 asm_sysvec_apic_timer_interrupt+0x12/0x20 arch/x86/include/asm/idtentry.h:635 RIP: 0010:arch_local_irq_restore arch/x86/include/asm/irqflags.h:84 [inline] RIP: 0010:console_unlock+0xe13/0x1390 kernel/printk/printk.c:2555 Code: 85 db 4c 8d b4 24 d0 01 00 00 48 8b 5c 24 68 0f 85 37 05 00 00 e8 0d 65 00 00 48 89 9c 24 b0 00 00 00 ff b4 24 b0 00 00 00 9d <48> 8b 44 24 30 42 80 3c 38 00 74 08 4c 89 f7 e8 e9 12 56 00 48 c7 RSP: 0018:ffffc90002046f60 EFLAGS: 00000246 RAX: ffffffff81527cb9 RBX: 0000000000000246 RCX: ffff88811678cf00 RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000001 RBP: ffffc90002047270 R08: ffffffff81521772 R09: 0000000000000003 R10: fffff52000408ddc R11: dffffc0000000001 R12: ffffffff866c48f0 R13: ffffc900020471d0 R14: ffffc90002047130 R15: dffffc0000000000 vprintk_emit+0x1c0/0x380 kernel/printk/printk.c:2063 dev_vprintk_emit+0x2ad/0x326 drivers/base/core.c:4447 dev_printk_emit+0xd9/0x118 drivers/base/core.c:4458 __dev_printk+0x17d/0x1b0 drivers/base/core.c:4470 _dev_warn+0x11e/0x165 drivers/base/core.c:4514 hid_parser_main+0x778/0xb00 drivers/hid/hid-core.c:635 hid_open_report+0xa9a/0x13e0 drivers/hid/hid-core.c:1268 hid_parse include/linux/hid.h:1048 [inline] hid_generic_probe+0x3f/0x90 drivers/hid/hid-generic.c:63 hid_device_probe+0x261/0x390 drivers/hid/hid-core.c:2302 really_probe+0x39c/0xaf0 drivers/base/dd.c:558 driver_probe_device+0xfd/0x260 drivers/base/dd.c:752 __device_attach_driver+0x29b/0x410 drivers/base/dd.c:863 bus_for_each_drv+0x183/0x200 drivers/base/bus.c:431 __device_attach+0x30a/0x500 drivers/base/dd.c:932 device_initial_probe+0x1a/0x20 drivers/base/dd.c:981 bus_probe_device+0xbe/0x1e0 drivers/base/bus.c:491 device_add+0x889/0xbc0 drivers/base/core.c:3255 hid_add_device+0x39c/0x4e0 drivers/hid/hid-core.c:2454 uhid_device_add_worker+0x45/0xf0 drivers/hid/uhid.c:73 process_one_work+0x6dc/0xbd0 kernel/workqueue.c:2301 worker_thread+0xaea/0x1510 kernel/workqueue.c:2447 kthread+0x34b/0x3d0 kernel/kthread.c:313 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:299 Allocated by task 3764: kasan_save_stack mm/kasan/common.c:38 [inline] kasan_set_track mm/kasan/common.c:45 [inline] set_alloc_info mm/kasan/common.c:430 [inline] ____kasan_kmalloc+0xdb/0x110 mm/kasan/common.c:509 __kasan_kmalloc+0x9/0x10 mm/kasan/common.c:518 kasan_kmalloc include/linux/kasan.h:254 [inline] __kmalloc+0x1aa/0x330 mm/slub.c:4033 __kmalloc_node include/linux/slab.h:418 [inline] kmalloc_node include/linux/slab.h:575 [inline] kvmalloc_node+0x82/0x130 mm/util.c:612 kvmalloc include/linux/mm.h:822 [inline] kvzalloc include/linux/mm.h:830 [inline] alloc_netdev_mqs+0x8e/0xcd0 net/core/dev.c:10506 alloc_etherdev_mqs+0x33/0x40 net/ethernet/eth.c:398 usbnet_probe+0x1ff/0x2860 drivers/net/usb/usbnet.c:1662 usb_probe_interface+0x5b6/0xa90 drivers/usb/core/driver.c:397 really_probe+0x3eb/0xaf0 drivers/base/dd.c:562 driver_probe_device+0xfd/0x260 drivers/base/dd.c:752 __device_attach_driver+0x29b/0x410 drivers/base/dd.c:863 bus_for_each_drv+0x183/0x200 drivers/base/bus.c:431 __device_attach+0x30a/0x500 drivers/base/dd.c:932 device_initial_probe+0x1a/0x20 drivers/base/dd.c:981 bus_probe_device+0xbe/0x1e0 drivers/base/bus.c:491 device_add+0x889/0xbc0 drivers/base/core.c:3255 usb_set_configuration+0x19a5/0x1f30 drivers/usb/core/message.c:2160 usb_generic_driver_probe+0x8b/0x150 drivers/usb/core/generic.c:238 usb_probe_device+0x144/0x260 drivers/usb/core/driver.c:294 really_probe+0x3eb/0xaf0 drivers/base/dd.c:562 driver_probe_device+0xfd/0x260 drivers/base/dd.c:752 __device_attach_driver+0x29b/0x410 drivers/base/dd.c:863 bus_for_each_drv+0x183/0x200 drivers/base/bus.c:431 __device_attach+0x30a/0x500 drivers/base/dd.c:932 device_initial_probe+0x1a/0x20 drivers/base/dd.c:981 bus_probe_device+0xbe/0x1e0 drivers/base/bus.c:491 device_add+0x889/0xbc0 drivers/base/core.c:3255 usb_new_device+0xbbc/0x1760 drivers/usb/core/hub.c:2596 hub_port_connect drivers/usb/core/hub.c:5437 [inline] hub_port_connect_change drivers/usb/core/hub.c:5577 [inline] port_event drivers/usb/core/hub.c:5727 [inline] hub_event+0x2d3b/0x47c0 drivers/usb/core/hub.c:5809 process_one_work+0x6dc/0xbd0 kernel/workqueue.c:2301 worker_thread+0xaea/0x1510 kernel/workqueue.c:2447 kthread+0x34b/0x3d0 kernel/kthread.c:313 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:299 Freed by task 3788: kasan_save_stack mm/kasan/common.c:38 [inline] kasan_set_track+0x4b/0x70 mm/kasan/common.c:45 kasan_set_free_info+0x23/0x40 mm/kasan/generic.c:370 ____kasan_slab_free+0x121/0x160 mm/kasan/common.c:362 __kasan_slab_free+0x11/0x20 mm/kasan/common.c:370 kasan_slab_free include/linux/kasan.h:220 [inline] slab_free_hook mm/slub.c:1595 [inline] slab_free_freelist_hook+0xc0/0x190 mm/slub.c:1621 slab_free mm/slub.c:3203 [inline] kfree+0xc3/0x270 mm/slub.c:4191 kvfree+0x35/0x40 mm/util.c:647 netdev_freemem+0x3f/0x60 net/core/dev.c:10460 netdev_release+0x7f/0xb0 net/core/net-sysfs.c:1886 device_release+0x95/0x1c0 kobject_cleanup lib/kobject.c:713 [inline] kobject_release lib/kobject.c:744 [inline] kref_put include/linux/kref.h:65 [inline] kobject_put+0x178/0x260 lib/kobject.c:761 put_device+0x1f/0x30 drivers/base/core.c:3354 free_netdev+0x384/0x470 net/core/dev.c:10637 usbnet_disconnect+0x242/0x3a0 drivers/net/usb/usbnet.c:1601 usb_unbind_interface+0x1fa/0x8c0 drivers/usb/core/driver.c:459 device_release_driver_internal+0x506/0x7c0 drivers/base/dd.c:1221 device_release_driver+0x19/0x20 drivers/base/dd.c:1244 bus_remove_device+0x2f8/0x360 drivers/base/bus.c:533 device_del+0x68b/0xf00 drivers/base/core.c:3434 usb_disable_device+0x380/0x720 drivers/usb/core/message.c:1411 usb_disconnect+0x32a/0x890 drivers/usb/core/hub.c:2252 hub_port_connect drivers/usb/core/hub.c:5276 [inline] hub_port_connect_change drivers/usb/core/hub.c:5577 [inline] port_event drivers/usb/core/hub.c:5727 [inline] hub_event+0x1e73/0x47c0 drivers/usb/core/hub.c:5809 process_one_work+0x6dc/0xbd0 kernel/workqueue.c:2301 worker_thread+0xaea/0x1510 kernel/workqueue.c:2447 kthread+0x34b/0x3d0 kernel/kthread.c:313 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:299 Last potentially related work creation: kasan_save_stack+0x3b/0x60 mm/kasan/common.c:38 __kasan_record_aux_stack+0xd3/0x100 mm/kasan/generic.c:348 kasan_record_aux_stack_noalloc+0xb/0x10 mm/kasan/generic.c:358 insert_work+0x56/0x310 kernel/workqueue.c:1352 __queue_work+0x970/0xd10 kernel/workqueue.c:1518 queue_work_on+0x105/0x160 kernel/workqueue.c:1545 usbnet_link_change+0xeb/0x100 usbnet_probe+0x1dff/0x2860 drivers/net/usb/usbnet.c:1808 usb_probe_interface+0x5b6/0xa90 drivers/usb/core/driver.c:397 really_probe+0x3eb/0xaf0 drivers/base/dd.c:562 driver_probe_device+0xfd/0x260 drivers/base/dd.c:752 __device_attach_driver+0x29b/0x410 drivers/base/dd.c:863 bus_for_each_drv+0x183/0x200 drivers/base/bus.c:431 __device_attach+0x30a/0x500 drivers/base/dd.c:932 device_initial_probe+0x1a/0x20 drivers/base/dd.c:981 bus_probe_device+0xbe/0x1e0 drivers/base/bus.c:491 device_add+0x889/0xbc0 drivers/base/core.c:3255 usb_set_configuration+0x19a5/0x1f30 drivers/usb/core/message.c:2160 usb_generic_driver_probe+0x8b/0x150 drivers/usb/core/generic.c:238 usb_probe_device+0x144/0x260 drivers/usb/core/driver.c:294 really_probe+0x3eb/0xaf0 drivers/base/dd.c:562 driver_probe_device+0xfd/0x260 drivers/base/dd.c:752 __device_attach_driver+0x29b/0x410 drivers/base/dd.c:863 bus_for_each_drv+0x183/0x200 drivers/base/bus.c:431 __device_attach+0x30a/0x500 drivers/base/dd.c:932 device_initial_probe+0x1a/0x20 drivers/base/dd.c:981 bus_probe_device+0xbe/0x1e0 drivers/base/bus.c:491 device_add+0x889/0xbc0 drivers/base/core.c:3255 usb_new_device+0xbbc/0x1760 drivers/usb/core/hub.c:2596 hub_port_connect drivers/usb/core/hub.c:5437 [inline] hub_port_connect_change drivers/usb/core/hub.c:5577 [inline] port_event drivers/usb/core/hub.c:5727 [inline] hub_event+0x2d3b/0x47c0 drivers/usb/core/hub.c:5809 process_one_work+0x6dc/0xbd0 kernel/workqueue.c:2301 worker_thread+0xaea/0x1510 kernel/workqueue.c:2447 kthread+0x34b/0x3d0 kernel/kthread.c:313 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:299 The buggy address belongs to the object at ffff88811243c000 which belongs to the cache kmalloc-4k of size 4096 The buggy address is located 3168 bytes inside of 4096-byte region [ffff88811243c000, ffff88811243d000) The buggy address belongs to the page: page:ffffea0004490e00 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x112438 head:ffffea0004490e00 order:3 compound_mapcount:0 compound_pincount:0 flags: 0x4000000000010200(slab|head) raw: 4000000000010200 0000000000000000 0000000200000001 ffff888100042c00 raw: 0000000000000000 0000000000040004 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 0xd20c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC), pid 96, ts 4419174958, free_ts 0 set_page_owner include/linux/page_owner.h:35 [inline] post_alloc_hook mm/page_alloc.c:2456 [inline] prep_new_page+0x166/0x180 mm/page_alloc.c:2462 get_page_from_freelist+0x2d8c/0x2f30 mm/page_alloc.c:4254 __alloc_pages_nodemask+0x435/0xaf0 mm/page_alloc.c:5346 allocate_slab mm/slub.c:1808 [inline] new_slab+0x80/0x400 mm/slub.c:1869 new_slab_objects mm/slub.c:2627 [inline] ___slab_alloc+0x302/0x4b0 mm/slub.c:2791 __slab_alloc+0x63/0xa0 mm/slub.c:2831 slab_alloc_node mm/slub.c:2913 [inline] slab_alloc mm/slub.c:2955 [inline] kmem_cache_alloc_trace+0x1bd/0x2e0 mm/slub.c:2972 kmalloc include/linux/slab.h:552 [inline] kzalloc include/linux/slab.h:664 [inline] uevent_show+0x160/0x310 drivers/base/core.c:2280 dev_attr_show+0x56/0xd0 drivers/base/core.c:1987 sysfs_kf_seq_show+0x265/0x3e0 fs/sysfs/file.c:61 kernfs_seq_show+0x119/0x160 fs/kernfs/file.c:168 seq_read_iter+0x430/0xd00 fs/seq_file.c:230 kernfs_fop_read_iter+0x145/0x470 fs/kernfs/file.c:241 call_read_iter include/linux/fs.h:2013 [inline] new_sync_read fs/read_write.c:415 [inline] vfs_read+0x999/0xbb0 fs/read_write.c:496 ksys_read+0x199/0x2c0 fs/read_write.c:634 __do_sys_read fs/read_write.c:644 [inline] __se_sys_read fs/read_write.c:642 [inline] __x64_sys_read+0x7b/0x90 fs/read_write.c:642 page_owner free stack trace missing Memory state around the buggy address: ffff88811243cb00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff88811243cb80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff88811243cc00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff88811243cc80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff88811243cd00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ================================================================== ---------------- Code disassembly (best guess): 0: 85 db test %ebx,%ebx 2: 4c 8d b4 24 d0 01 00 lea 0x1d0(%rsp),%r14 9: 00 a: 48 8b 5c 24 68 mov 0x68(%rsp),%rbx f: 0f 85 37 05 00 00 jne 0x54c 15: e8 0d 65 00 00 call 0x6527 1a: 48 89 9c 24 b0 00 00 mov %rbx,0xb0(%rsp) 21: 00 22: ff b4 24 b0 00 00 00 push 0xb0(%rsp) 29: 9d popf * 2a: 48 8b 44 24 30 mov 0x30(%rsp),%rax <-- trapping instruction 2f: 42 80 3c 38 00 cmpb $0x0,(%rax,%r15,1) 34: 74 08 je 0x3e 36: 4c 89 f7 mov %r14,%rdi 39: e8 e9 12 56 00 call 0x561327 3e: 48 rex.W 3f: c7 .byte 0xc7