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 ffff88807ba65c58 by task vivid-001-vid-o/15761
CPU: 1 PID: 15761 Comm: vivid-001-vid-o Not tainted 5.16.0-rc8-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/0x2ed mm/kasan/report.c:247
__kasan_report mm/kasan/report.c:433 [inline]
kasan_report.cold+0x83/0xdf mm/kasan/report.c:450
__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:__schedule+0xaa2/0x4900 kernel/sched/core.c:6132
Code: fa 48 c1 ea 03 80 3c 02 00 0f 85 ed 3d 00 00 48 8b bd 70 ff ff ff 4d 89 65 10 4c 89 e6 e8 06 d8 ba f7 48 89 c7 e8 fe 56 0a f8 <48> 8b b5 f8 fe ff ff 48 b8 00 00 00 00 00 fc ff df 48 c7 04 06 00
RSP: 0018:ffffc90000ebfcd8 EFLAGS: 00000206
RAX: 000000000000a8e7 RBX: 0000000000000001 RCX: 1ffffffff1b21e81
RDX: 0000000000000000 RSI: 0000000000000001 RDI: 0000000000000000
RBP: ffffc90000ebfdf0 R08: 0000000000000001 R09: 0000000000000001
R10: ffffffff817d08b8 R11: 0000000000000000 R12: ffff8880b9d3a5c0
R13: ffff8880b9d39b00 R14: 0000000000000000 R15: ffffffff8b5547b0
schedule+0xd2/0x260 kernel/sched/core.c:6326
vivid_thread_vid_out+0xf2c/0x1af0 drivers/media/test-drivers/vivid/vivid-kthread-out.c:238
kthread+0x405/0x4f0 kernel/kthread.c:327
ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:295
Allocated by task 3677:
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:434 [inline]
____kasan_kmalloc mm/kasan/common.c:513 [inline]
____kasan_kmalloc mm/kasan/common.c:472 [inline]
__kasan_kmalloc+0xa6/0xd0 mm/kasan/common.c:522
kasan_kmalloc include/linux/kasan.h:269 [inline]
kmem_cache_alloc_trace+0x1ea/0x4a0 mm/slab.c:3575
kmalloc include/linux/slab.h:590 [inline]
kzalloc include/linux/slab.h:724 [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:3394
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:3394
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 15768:
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:366 [inline]
____kasan_slab_free mm/kasan/common.c:328 [inline]
__kasan_slab_free+0xd1/0x110 mm/kasan/common.c:374
kasan_slab_free include/linux/kasan.h:235 [inline]
__cache_free mm/slab.c:3445 [inline]
kfree+0x10d/0x2c0 mm/slab.c:3802
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/0xd60 drivers/base/core.c:3581
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+0xb5/0xe0 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
mpls_dev_sysctl_unregister net/mpls/af_mpls.c:1441 [inline]
mpls_dev_notify+0x4fb/0x8a0 net/mpls/af_mpls.c:1654
notifier_call_chain+0xb5/0x200 kernel/notifier.c:83
call_netdevice_notifiers_info+0xb5/0x130 net/core/dev.c:2002
call_netdevice_notifiers_extack net/core/dev.c:2014 [inline]
call_netdevice_notifiers net/core/dev.c:2028 [inline]
unregister_netdevice_many+0x94f/0x1790 net/core/dev.c:11080
ip6_tnl_exit_batch_net+0x5f5/0x890 net/ipv6/ip6_tunnel.c:2311
ops_exit_list+0x10d/0x160 net/core/net_namespace.c:171
cleanup_net+0x4ea/0xb00 net/core/net_namespace.c:593
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
Second to last potentially related work creation:
kasan_save_stack+0x1e/0x50 mm/kasan/common.c:38
__kasan_record_aux_stack+0xb5/0xe0 mm/kasan/generic.c:348
__call_rcu kernel/rcu/tree.c:2985 [inline]
call_rcu+0xb1/0x740 kernel/rcu/tree.c:3065
fib6_info_release include/net/ip6_fib.h:337 [inline]
fib6_info_release include/net/ip6_fib.h:334 [inline]
fib6_del_route net/ipv6/ip6_fib.c:1994 [inline]
fib6_del+0x11d7/0x15d0 net/ipv6/ip6_fib.c:2027
fib6_clean_node+0x393/0x5c0 net/ipv6/ip6_fib.c:2189
fib6_walk_continue+0x3e9/0x6c0 net/ipv6/ip6_fib.c:2111
fib6_walk+0x182/0x370 net/ipv6/ip6_fib.c:2159
fib6_clean_tree+0xdb/0x120 net/ipv6/ip6_fib.c:2239
__fib6_clean_all+0x107/0x2a0 net/ipv6/ip6_fib.c:2255
rt6_sync_down_dev net/ipv6/route.c:4907 [inline]
rt6_disable_ip+0x844/0x940 net/ipv6/route.c:4912
addrconf_ifdown.isra.0+0xf6/0x1630 net/ipv6/addrconf.c:3726
addrconf_notify+0xeb/0x1bb0 net/ipv6/addrconf.c:3651
notifier_call_chain+0xb5/0x200 kernel/notifier.c:83
call_netdevice_notifiers_info+0xb5/0x130 net/core/dev.c:2002
call_netdevice_notifiers_extack net/core/dev.c:2014 [inline]
call_netdevice_notifiers net/core/dev.c:2028 [inline]
dev_close_many+0x2ff/0x620 net/core/dev.c:1603
unregister_netdevice_many+0x3ff/0x1790 net/core/dev.c:11057
default_device_exit_batch+0x2fa/0x3c0 net/core/dev.c:11610
ops_exit_list+0x10d/0x160 net/core/net_namespace.c:171
cleanup_net+0x4ea/0xb00 net/core/net_namespace.c:593
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
The buggy address belongs to the object at ffff88807ba65c00
which belongs to the cache kmalloc-256 of size 256
The buggy address is located 88 bytes inside of
256-byte region [ffff88807ba65c00, ffff88807ba65d00)
The buggy address belongs to the page:
page:ffffea0001ee9940 refcount:1 mapcount:0 mapping:0000000000000000 index:0xffff88807ba65600 pfn:0x7ba65
flags: 0xfff00000000200(slab|node=0|zone=1|lastcpupid=0x7ff)
raw: 00fff00000000200 ffffea00007bb4c8 ffffea0001ca4f48 ffff888010c40500
raw: ffff88807ba65600 ffff88807ba65000 0000000100000002 0000000000000000
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 0, migratetype Unmovable, gfp_mask 0x242040(__GFP_IO|__GFP_NOWARN|__GFP_COMP|__GFP_THISNODE), pid 2973, ts 144372077820, free_ts 144372065074
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_node include/linux/gfp.h:570 [inline]
kmem_getpages mm/slab.c:1377 [inline]
cache_grow_begin+0x75/0x470 mm/slab.c:2593
cache_alloc_refill+0x27f/0x380 mm/slab.c:2965
____cache_alloc mm/slab.c:3048 [inline]
____cache_alloc mm/slab.c:3031 [inline]
__do_cache_alloc mm/slab.c:3275 [inline]
slab_alloc mm/slab.c:3316 [inline]
kmem_cache_alloc_trace+0x380/0x4a0 mm/slab.c:3573
kmalloc include/linux/slab.h:590 [inline]
inode_doinit_use_xattr+0x54/0x340 security/selinux/hooks.c:1374
inode_doinit_with_dentry+0x10ec/0x12e0 security/selinux/hooks.c:1565
selinux_d_instantiate+0x23/0x30 security/selinux/hooks.c:6390
security_d_instantiate+0x50/0xe0 security/security.c:2040
d_splice_alias+0x8c/0xc60 fs/dcache.c:3064
kernfs_iop_lookup+0x22d/0x2c0 fs/kernfs/dir.c:1137
lookup_open.isra.0+0x69f/0x13d0 fs/namei.c:3258
open_last_lookups fs/namei.c:3350 [inline]
path_openat+0x9b8/0x2750 fs/namei.c:3556
do_filp_open+0x1aa/0x400 fs/namei.c:3586
do_sys_openat2+0x16d/0x4d0 fs/open.c:1212
do_sys_open fs/open.c:1228 [inline]
__do_sys_openat fs/open.c:1244 [inline]
__se_sys_openat fs/open.c:1239 [inline]
__x64_sys_openat+0x13f/0x1f0 fs/open.c:1239
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
selinux_genfs_get_sid security/selinux/hooks.c:1361 [inline]
inode_doinit_with_dentry+0x868/0x12e0 security/selinux/hooks.c:1556
selinux_d_instantiate+0x23/0x30 security/selinux/hooks.c:6390
security_d_instantiate+0x50/0xe0 security/security.c:2040
d_splice_alias+0x8c/0xc60 fs/dcache.c:3064
kernfs_iop_lookup+0x22d/0x2c0 fs/kernfs/dir.c:1137
lookup_open.isra.0+0x69f/0x13d0 fs/namei.c:3258
open_last_lookups fs/namei.c:3350 [inline]
path_openat+0x9b8/0x2750 fs/namei.c:3556
do_filp_open+0x1aa/0x400 fs/namei.c:3586
do_sys_openat2+0x16d/0x4d0 fs/open.c:1212
do_sys_open fs/open.c:1228 [inline]
__do_sys_openat fs/open.c:1244 [inline]
__se_sys_openat fs/open.c:1239 [inline]
__x64_sys_openat+0x13f/0x1f0 fs/open.c:1239
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
Memory state around the buggy address:
ffff88807ba65b00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
ffff88807ba65b80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
>ffff88807ba65c00: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
^
ffff88807ba65c80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff88807ba65d00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
==================================================================
----------------
Code disassembly (best guess):
0: fa cli
1: 48 c1 ea 03 shr $0x3,%rdx
5: 80 3c 02 00 cmpb $0x0,(%rdx,%rax,1)
9: 0f 85 ed 3d 00 00 jne 0x3dfc
f: 48 8b bd 70 ff ff ff mov -0x90(%rbp),%rdi
16: 4d 89 65 10 mov %r12,0x10(%r13)
1a: 4c 89 e6 mov %r12,%rsi
1d: e8 06 d8 ba f7 callq 0xf7bad828
22: 48 89 c7 mov %rax,%rdi
25: e8 fe 56 0a f8 callq 0xf80a5728
* 2a: 48 8b b5 f8 fe ff ff mov -0x108(%rbp),%rsi <-- trapping instruction
31: 48 b8 00 00 00 00 00 movabs $0xdffffc0000000000,%rax
38: fc ff df
3b: 48 rex.W
3c: c7 .byte 0xc7
3d: 04 06 add $0x6,%al