powermate: config urb returned -108 ================================================================== BUG: KASAN: use-after-free in __lock_acquire+0x3c2f/0x5470 kernel/locking/lockdep.c:4897 Read of size 8 at addr ffff888076a17058 by task syz-executor.0/6457 CPU: 0 PID: 6457 Comm: syz-executor.0 Not tainted 5.16.0-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0xcd/0x134 lib/dump_stack.c:106 print_address_description.constprop.0.cold+0x8d/0x320 mm/kasan/report.c:255 __kasan_report mm/kasan/report.c:442 [inline] kasan_report.cold+0x83/0xdf mm/kasan/report.c:459 __lock_acquire+0x3c2f/0x5470 kernel/locking/lockdep.c:4897 lock_acquire kernel/locking/lockdep.c:5637 [inline] lock_acquire+0x1ab/0x510 kernel/locking/lockdep.c:5602 __raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:110 [inline] _raw_spin_lock_irqsave+0x39/0x50 kernel/locking/spinlock.c:162 powermate_config_complete+0x79/0xb0 drivers/input/misc/powermate.c:202 __usb_hcd_giveback_urb+0x2b0/0x5c0 drivers/usb/core/hcd.c:1656 usb_hcd_giveback_urb+0x367/0x410 drivers/usb/core/hcd.c:1726 dummy_timer+0x11f9/0x32b0 drivers/usb/gadget/udc/dummy_hcd.c:1987 call_timer_fn+0x1a5/0x6b0 kernel/time/timer.c:1421 expire_timers kernel/time/timer.c:1466 [inline] __run_timers.part.0+0x67c/0xa30 kernel/time/timer.c:1734 __run_timers kernel/time/timer.c:1715 [inline] run_timer_softirq+0xb3/0x1d0 kernel/time/timer.c:1747 __do_softirq+0x29b/0x9c2 kernel/softirq.c:558 invoke_softirq kernel/softirq.c:432 [inline] __irq_exit_rcu+0x123/0x180 kernel/softirq.c:637 irq_exit_rcu+0x5/0x20 kernel/softirq.c:649 sysvec_apic_timer_interrupt+0x93/0xc0 arch/x86/kernel/apic/apic.c:1097 asm_sysvec_apic_timer_interrupt+0x12/0x20 arch/x86/include/asm/idtentry.h:638 RIP: 0010:__raw_spin_unlock_irqrestore include/linux/spinlock_api_smp.h:152 [inline] RIP: 0010:_raw_spin_unlock_irqrestore+0x38/0x70 kernel/locking/spinlock.c:194 Code: 74 24 10 e8 4a 03 11 f8 48 89 ef e8 02 79 11 f8 81 e3 00 02 00 00 75 25 9c 58 f6 c4 02 75 2d 48 85 db 74 01 fb bf 01 00 00 00 43 43 04 f8 65 8b 05 cc e8 b6 76 85 c0 74 0a 5b 5d c3 e8 90 2f RSP: 0018:ffffc90003fef738 EFLAGS: 00000206 RAX: 0000000000000006 RBX: 0000000000000200 RCX: 1ffffffff1ffc1be RDX: 0000000000000000 RSI: 0000000000000001 RDI: 0000000000000001 RBP: ffff88805c72a1d0 R08: 0000000000000001 R09: ffffffff8ffa2aa7 R10: 0000000000000001 R11: 0000000000000000 R12: ffff88805c72a1b8 R13: ffffc90003fef8c0 R14: ffff8880579e33c0 R15: 0000000000000246 spin_unlock_irqrestore include/linux/spinlock.h:404 [inline] __skb_try_recv_datagram+0x168/0x4e0 net/core/datagram.c:267 __unix_dgram_recvmsg+0x190/0xb80 net/unix/af_unix.c:2391 unix_dgram_recvmsg+0xca/0xf0 net/unix/af_unix.c:2489 sock_recvmsg_nosec net/socket.c:948 [inline] ____sys_recvmsg+0x527/0x600 net/socket.c:2630 ___sys_recvmsg+0x127/0x200 net/socket.c:2674 do_recvmmsg+0x24d/0x6d0 net/socket.c:2768 __sys_recvmmsg net/socket.c:2847 [inline] __do_sys_recvmmsg net/socket.c:2870 [inline] __se_sys_recvmmsg net/socket.c:2863 [inline] __x64_sys_recvmmsg+0x20b/0x260 net/socket.c:2863 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x44/0xae RIP: 0033:0x7fdfbf740e99 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 bc ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007fdfbe095168 EFLAGS: 00000246 ORIG_RAX: 000000000000012b RAX: ffffffffffffffda RBX: 00007fdfbf854030 RCX: 00007fdfbf740e99 RDX: 0000000000010106 RSI: 00000000200000c0 RDI: 0000000000000003 RBP: 00007fdfbf79aff1 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000002 R11: 0000000000000246 R12: 0000000000000000 R13: 00007fdfbfd87b1f R14: 00007fdfbe095300 R15: 0000000000022000 Allocated by task 924: kasan_save_stack+0x1e/0x50 mm/kasan/common.c:38 kasan_set_track mm/kasan/common.c:46 [inline] set_alloc_info mm/kasan/common.c:437 [inline] ____kasan_kmalloc mm/kasan/common.c:516 [inline] ____kasan_kmalloc mm/kasan/common.c:475 [inline] __kasan_kmalloc+0xa9/0xd0 mm/kasan/common.c:525 kmalloc include/linux/slab.h:582 [inline] kzalloc include/linux/slab.h:716 [inline] powermate_probe+0x24a/0x12a0 drivers/input/misc/powermate.c:323 usb_probe_interface+0x315/0x7f0 drivers/usb/core/driver.c:396 call_driver_probe drivers/base/dd.c:517 [inline] really_probe+0x245/0xcc0 drivers/base/dd.c:596 __driver_probe_device+0x338/0x4d0 drivers/base/dd.c:751 driver_probe_device+0x4c/0x1a0 drivers/base/dd.c:781 __device_attach_driver+0x20b/0x2f0 drivers/base/dd.c:898 bus_for_each_drv+0x15f/0x1e0 drivers/base/bus.c:427 __device_attach+0x228/0x4a0 drivers/base/dd.c:969 bus_probe_device+0x1e4/0x290 drivers/base/bus.c:487 device_add+0xc17/0x1ee0 drivers/base/core.c:3393 usb_set_configuration+0x101e/0x1900 drivers/usb/core/message.c:2170 usb_generic_driver_probe+0xba/0x100 drivers/usb/core/generic.c:238 usb_probe_device+0xd9/0x2c0 drivers/usb/core/driver.c:293 call_driver_probe drivers/base/dd.c:517 [inline] really_probe+0x245/0xcc0 drivers/base/dd.c:596 __driver_probe_device+0x338/0x4d0 drivers/base/dd.c:751 driver_probe_device+0x4c/0x1a0 drivers/base/dd.c:781 __device_attach_driver+0x20b/0x2f0 drivers/base/dd.c:898 bus_for_each_drv+0x15f/0x1e0 drivers/base/bus.c:427 __device_attach+0x228/0x4a0 drivers/base/dd.c:969 bus_probe_device+0x1e4/0x290 drivers/base/bus.c:487 device_add+0xc17/0x1ee0 drivers/base/core.c:3393 usb_new_device.cold+0x63f/0x108e drivers/usb/core/hub.c:2563 hub_port_connect drivers/usb/core/hub.c:5353 [inline] hub_port_connect_change drivers/usb/core/hub.c:5497 [inline] port_event drivers/usb/core/hub.c:5643 [inline] hub_event+0x23e5/0x4460 drivers/usb/core/hub.c:5725 process_one_work+0x9b2/0x1660 kernel/workqueue.c:2298 worker_thread+0x65d/0x1130 kernel/workqueue.c:2445 kthread+0x405/0x4f0 kernel/kthread.c:327 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:295 Freed by task 6458: kasan_save_stack+0x1e/0x50 mm/kasan/common.c:38 kasan_set_track+0x21/0x30 mm/kasan/common.c:46 kasan_set_free_info+0x20/0x30 mm/kasan/generic.c:370 ____kasan_slab_free mm/kasan/common.c:367 [inline] ____kasan_slab_free+0x130/0x160 mm/kasan/common.c:329 kasan_slab_free include/linux/kasan.h:236 [inline] slab_free_hook mm/slub.c:1728 [inline] slab_free_freelist_hook+0x8b/0x1c0 mm/slub.c:1754 slab_free mm/slub.c:3509 [inline] kfree+0xcb/0x280 mm/slub.c:4562 powermate_disconnect+0x1ce/0x250 drivers/input/misc/powermate.c:432 usb_unbind_interface+0x1d8/0x8e0 drivers/usb/core/driver.c:458 __device_release_driver+0x5d7/0x700 drivers/base/dd.c:1205 device_release_driver_internal drivers/base/dd.c:1236 [inline] device_release_driver+0x26/0x40 drivers/base/dd.c:1259 bus_remove_device+0x2eb/0x5a0 drivers/base/bus.c:529 device_del+0x502/0xd50 drivers/base/core.c:3580 usb_disable_device+0x35b/0x7b0 drivers/usb/core/message.c:1419 usb_disconnect.cold+0x27a/0x78e drivers/usb/core/hub.c:2225 hub_quiesce+0x170/0x310 drivers/usb/core/hub.c:1327 hub_disconnect+0xcb/0x510 drivers/usb/core/hub.c:1722 usb_unbind_interface+0x1d8/0x8e0 drivers/usb/core/driver.c:458 __device_release_driver+0x5d7/0x700 drivers/base/dd.c:1205 device_release_driver_internal drivers/base/dd.c:1236 [inline] device_release_driver+0x26/0x40 drivers/base/dd.c:1259 usb_driver_release_interface+0x102/0x180 drivers/usb/core/driver.c:627 proc_ioctl.part.0+0x4d6/0x560 drivers/usb/core/devio.c:2332 proc_ioctl drivers/usb/core/devio.c:170 [inline] proc_ioctl_default drivers/usb/core/devio.c:2375 [inline] usbdev_do_ioctl drivers/usb/core/devio.c:2731 [inline] usbdev_ioctl+0x2b29/0x36c0 drivers/usb/core/devio.c:2791 vfs_ioctl fs/ioctl.c:51 [inline] __do_sys_ioctl fs/ioctl.c:874 [inline] __se_sys_ioctl fs/ioctl.c:860 [inline] __x64_sys_ioctl+0x193/0x200 fs/ioctl.c:860 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x44/0xae Last potentially related work creation: kasan_save_stack+0x1e/0x50 mm/kasan/common.c:38 __kasan_record_aux_stack+0xbe/0xd0 mm/kasan/generic.c:348 kvfree_call_rcu+0x74/0x990 kernel/rcu/tree.c:3550 drop_sysctl_table+0x3c0/0x4e0 fs/proc/proc_sysctl.c:1647 unregister_sysctl_table fs/proc/proc_sysctl.c:1685 [inline] unregister_sysctl_table+0xc0/0x190 fs/proc/proc_sysctl.c:1660 __devinet_sysctl_unregister net/ipv4/devinet.c:2604 [inline] devinet_sysctl_unregister net/ipv4/devinet.c:2632 [inline] inetdev_event+0xe36/0x15d0 net/ipv4/devinet.c:1608 notifier_call_chain+0xb5/0x200 kernel/notifier.c:84 call_netdevice_notifiers_info+0xb5/0x130 net/core/dev.c:1919 call_netdevice_notifiers_extack net/core/dev.c:1931 [inline] call_netdevice_notifiers net/core/dev.c:1945 [inline] dev_change_name+0x50b/0x7a0 net/core/dev.c:1201 do_setlink+0x2c6d/0x3a10 net/core/rtnetlink.c:2709 __rtnl_newlink+0xde7/0x1750 net/core/rtnetlink.c:3412 rtnl_newlink+0x64/0xa0 net/core/rtnetlink.c:3527 rtnetlink_rcv_msg+0x413/0xb80 net/core/rtnetlink.c:5592 netlink_rcv_skb+0x153/0x420 net/netlink/af_netlink.c:2494 netlink_unicast_kernel net/netlink/af_netlink.c:1317 [inline] netlink_unicast+0x539/0x7e0 net/netlink/af_netlink.c:1343 netlink_sendmsg+0x904/0xe00 net/netlink/af_netlink.c:1919 sock_sendmsg_nosec net/socket.c:705 [inline] sock_sendmsg+0xcf/0x120 net/socket.c:725 __sys_sendto+0x21c/0x320 net/socket.c:2040 __do_sys_sendto net/socket.c:2052 [inline] __se_sys_sendto net/socket.c:2048 [inline] __x64_sys_sendto+0xdd/0x1b0 net/socket.c:2048 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x44/0xae The buggy address belongs to the object at ffff888076a17000 which belongs to the cache kmalloc-256 of size 256 The buggy address is located 88 bytes inside of 256-byte region [ffff888076a17000, ffff888076a17100) The buggy address belongs to the page: page:ffffea0001da8580 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x76a16 head:ffffea0001da8580 order:1 compound_mapcount:0 flags: 0xfff00000010200(slab|head|node=0|zone=1|lastcpupid=0x7ff) raw: 00fff00000010200 ffffea00006c1b00 dead000000000004 ffff888010c41b40 raw: 0000000000000000 0000000000100010 00000001ffffffff 0000000000000000 page dumped because: kasan: bad access detected page_owner tracks the page as allocated page last allocated via order 1, migratetype Unmovable, gfp_mask 0x1d20c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC|__GFP_HARDWALL), pid 4068, ts 77734166246, free_ts 77668449190 prep_new_page mm/page_alloc.c:2418 [inline] get_page_from_freelist+0xa72/0x2f50 mm/page_alloc.c:4149 __alloc_pages+0x1b2/0x500 mm/page_alloc.c:5369 alloc_pages+0x1a7/0x300 mm/mempolicy.c:2190 alloc_slab_page mm/slub.c:1799 [inline] allocate_slab mm/slub.c:1944 [inline] new_slab+0x28a/0x3b0 mm/slub.c:2004 ___slab_alloc+0x87c/0xe90 mm/slub.c:3018 __slab_alloc.constprop.0+0x4d/0xa0 mm/slub.c:3105 slab_alloc_node mm/slub.c:3196 [inline] slab_alloc mm/slub.c:3238 [inline] __kmalloc+0x2fb/0x340 mm/slub.c:4420 kmalloc include/linux/slab.h:587 [inline] kzalloc include/linux/slab.h:716 [inline] fib_create_info+0xd91/0x48e0 net/ipv4/fib_semantics.c:1454 fib_table_insert+0x1cd/0x1af0 net/ipv4/fib_trie.c:1224 fib_magic+0x455/0x540 net/ipv4/fib_frontend.c:1087 fib_add_ifaddr+0x395/0x500 net/ipv4/fib_frontend.c:1122 fib_netdev_event+0x462/0x680 net/ipv4/fib_frontend.c:1466 notifier_call_chain+0xb5/0x200 kernel/notifier.c:84 call_netdevice_notifiers_info+0xb5/0x130 net/core/dev.c:1919 call_netdevice_notifiers_extack net/core/dev.c:1931 [inline] call_netdevice_notifiers net/core/dev.c:1945 [inline] __dev_notify_flags+0x110/0x2b0 net/core/dev.c:8177 dev_change_flags+0x112/0x170 net/core/dev.c:8215 page last free stack trace: reset_page_owner include/linux/page_owner.h:24 [inline] free_pages_prepare mm/page_alloc.c:1338 [inline] free_pcp_prepare+0x374/0x870 mm/page_alloc.c:1389 free_unref_page_prepare mm/page_alloc.c:3309 [inline] free_unref_page+0x19/0x690 mm/page_alloc.c:3388 qlink_free mm/kasan/quarantine.c:146 [inline] qlist_free_all+0x5e/0xf0 mm/kasan/quarantine.c:165 kasan_quarantine_reduce+0x180/0x200 mm/kasan/quarantine.c:272 __kasan_slab_alloc+0xa2/0xc0 mm/kasan/common.c:447 kasan_slab_alloc include/linux/kasan.h:260 [inline] slab_post_alloc_hook mm/slab.h:738 [inline] slab_alloc_node mm/slub.c:3230 [inline] slab_alloc mm/slub.c:3238 [inline] kmem_cache_alloc_trace+0x1e9/0x2c0 mm/slub.c:3255 kmalloc include/linux/slab.h:582 [inline] kzalloc include/linux/slab.h:716 [inline] ____ip_mc_inc_group+0x244/0xc70 net/ipv4/igmp.c:1442 __ip_mc_inc_group net/ipv4/igmp.c:1477 [inline] ip_mc_inc_group net/ipv4/igmp.c:1483 [inline] ip_mc_up+0x14b/0x360 net/ipv4/igmp.c:1782 inetdev_event+0x2e8/0x15d0 net/ipv4/devinet.c:1575 notifier_call_chain+0xb5/0x200 kernel/notifier.c:84 call_netdevice_notifiers_info+0xb5/0x130 net/core/dev.c:1919 call_netdevice_notifiers_extack net/core/dev.c:1931 [inline] call_netdevice_notifiers net/core/dev.c:1945 [inline] __dev_notify_flags+0x110/0x2b0 net/core/dev.c:8177 dev_change_flags+0x112/0x170 net/core/dev.c:8215 do_setlink+0x96d/0x3a10 net/core/rtnetlink.c:2729 __rtnl_newlink+0xde7/0x1750 net/core/rtnetlink.c:3412 rtnl_newlink+0x64/0xa0 net/core/rtnetlink.c:3527 Memory state around the buggy address: ffff888076a16f00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ffff888076a16f80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc >ffff888076a17000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff888076a17080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff888076a17100: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ================================================================== ---------------- Code disassembly (best guess): 0: 74 24 je 0x26 2: 10 e8 adc %ch,%al 4: 4a 03 11 rex.WX add (%rcx),%rdx 7: f8 clc 8: 48 89 ef mov %rbp,%rdi b: e8 02 79 11 f8 callq 0xf8117912 10: 81 e3 00 02 00 00 and $0x200,%ebx 16: 75 25 jne 0x3d 18: 9c pushfq 19: 58 pop %rax 1a: f6 c4 02 test $0x2,%ah 1d: 75 2d jne 0x4c 1f: 48 85 db test %rbx,%rbx 22: 74 01 je 0x25 24: fb sti 25: bf 01 00 00 00 mov $0x1,%edi * 2a: e8 43 43 04 f8 callq 0xf8044372 <-- trapping instruction 2f: 65 8b 05 cc e8 b6 76 mov %gs:0x76b6e8cc(%rip),%eax # 0x76b6e902 36: 85 c0 test %eax,%eax 38: 74 0a je 0x44 3a: 5b pop %rbx 3b: 5d pop %rbp 3c: c3 retq 3d: e8 .byte 0xe8 3e: 90 nop 3f: 2f (bad)