usb 3-1: USB disconnect, device number 52
=========================
WARNING: held lock freed!
5.16.0-rc1-syzkaller #0 Not tainted
-------------------------
kworker/1:0/28245 is freeing memory ffff8880895c8000-ffff8880895c8fff, with a lock still held there!
ffff8880895c8668 (&ctlr->add_lock){+.+.}-{3:3}, at: spi_unregister_controller+0x53/0x340 drivers/spi/spi.c:3084
8 locks held by kworker/1:0/28245:
#0: ffff888012d92138 ((wq_completion)usb_hub_wq){+.+.}-{0:0}, at: process_one_work+0x7ca/0x1140
#1: ffffc900184a7d20 ((work_completion)(&hub->events)){+.+.}-{0:0}, at: process_one_work+0x808/0x1140 kernel/workqueue.c:2273
#2: ffff8881478ec220 (&dev->mutex){....}-{3:3}, at: device_lock include/linux/device.h:760 [inline]
#2: ffff8881478ec220 (&dev->mutex){....}-{3:3}, at: hub_event+0x1b2/0xe40 drivers/usb/core/hub.c:5662
#3: ffff888087f25220 (&dev->mutex){....}-{3:3}, at: device_lock include/linux/device.h:760 [inline]
#3: ffff888087f25220 (&dev->mutex){....}-{3:3}, at: usb_disconnect+0xfa/0x8a0 drivers/usb/core/hub.c:2216
#4: ffff8880863981a8 (&dev->mutex){....}-{3:3}, at: device_lock include/linux/device.h:760 [inline]
#4: ffff8880863981a8 (&dev->mutex){....}-{3:3}, at: __device_driver_lock drivers/base/dd.c:1032 [inline]
#4: ffff8880863981a8 (&dev->mutex){....}-{3:3}, at: device_release_driver_internal+0xc1/0x7b0 drivers/base/dd.c:1233
#5: ffff88806eb84d38 (&dev->vb_queue_lock){+.+.}-{3:3}, at: msi2500_disconnect+0x4f/0x120 drivers/media/usb/msi2500/msi2500.c:571
#6: ffff88806eb84ca8 (&dev->v4l2_lock){+.+.}-{3:3}, at: msi2500_disconnect+0x60/0x120 drivers/media/usb/msi2500/msi2500.c:572
#7: ffff8880895c8668 (&ctlr->add_lock){+.+.}-{3:3}, at: spi_unregister_controller+0x53/0x340 drivers/spi/spi.c:3084
stack backtrace:
CPU: 1 PID: 28245 Comm: kworker/1:0 Not tainted 5.16.0-rc1-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Workqueue: usb_hub_wq hub_event
Call Trace:
__dump_stack lib/dump_stack.c:88 [inline]
dump_stack_lvl+0x1dc/0x2d8 lib/dump_stack.c:106
print_freed_lock_bug kernel/locking/lockdep.c:6388 [inline]
debug_check_no_locks_freed+0x71f/0x9b0 kernel/locking/lockdep.c:6421
slab_free_hook mm/slub.c:1695 [inline]
slab_free_freelist_hook+0xbe/0x1a0 mm/slub.c:1749
slab_free mm/slub.c:3513 [inline]
kfree+0xe1/0x330 mm/slub.c:4561
device_release+0x98/0x1c0
kobject_cleanup+0x1c0/0x280 lib/kobject.c:705
spi_unregister_controller+0x272/0x340 drivers/spi/spi.c:3106
msi2500_disconnect+0xbf/0x120 drivers/media/usb/msi2500/msi2500.c:577
usb_unbind_interface+0x1f2/0x860 drivers/usb/core/driver.c:458
__device_release_driver drivers/base/dd.c:1205 [inline]
device_release_driver_internal+0x523/0x7b0 drivers/base/dd.c:1236
bus_remove_device+0x2fd/0x410 drivers/base/bus.c:529
device_del+0x6f1/0xbf0 drivers/base/core.c:3581
usb_disable_device+0x407/0x800 drivers/usb/core/message.c:1419
usb_disconnect+0x33a/0x8a0 drivers/usb/core/hub.c:2225
hub_port_connect+0x297/0x27d0 drivers/usb/core/hub.c:5199
hub_port_connect_change+0x5f9/0xc20 drivers/usb/core/hub.c:5488
port_event+0xb67/0x1220 drivers/usb/core/hub.c:5634
hub_event+0x4ed/0xe40 drivers/usb/core/hub.c:5716
process_one_work+0x853/0x1140 kernel/workqueue.c:2298
process_scheduled_works kernel/workqueue.c:2361 [inline]
worker_thread+0xe28/0x1320 kernel/workqueue.c:2447
kthread+0x468/0x490 kernel/kthread.c:327
ret_from_fork+0x1f/0x30
==================================================================
BUG: KASAN: use-after-free in instrument_atomic_read include/linux/instrumented.h:71 [inline]
BUG: KASAN: use-after-free in atomic_long_read include/linux/atomic/atomic-instrumented.h:1183 [inline]
BUG: KASAN: use-after-free in __mutex_unlock_slowpath+0x111/0x7d0 kernel/locking/mutex.c:909
Read of size 8 at addr ffff8880895c8600 by task kworker/1:0/28245
CPU: 1 PID: 28245 Comm: kworker/1:0 Not tainted 5.16.0-rc1-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Workqueue: usb_hub_wq hub_event
Call Trace:
__dump_stack lib/dump_stack.c:88 [inline]
dump_stack_lvl+0x1dc/0x2d8 lib/dump_stack.c:106
print_address_description+0x65/0x380 mm/kasan/report.c:247
__kasan_report mm/kasan/report.c:433 [inline]
kasan_report+0x19a/0x1f0 mm/kasan/report.c:450
kasan_check_range+0x2b5/0x2f0 mm/kasan/generic.c:189
instrument_atomic_read include/linux/instrumented.h:71 [inline]
atomic_long_read include/linux/atomic/atomic-instrumented.h:1183 [inline]
__mutex_unlock_slowpath+0x111/0x7d0 kernel/locking/mutex.c:909
msi2500_disconnect+0xbf/0x120 drivers/media/usb/msi2500/msi2500.c:577
usb_unbind_interface+0x1f2/0x860 drivers/usb/core/driver.c:458
__device_release_driver drivers/base/dd.c:1205 [inline]
device_release_driver_internal+0x523/0x7b0 drivers/base/dd.c:1236
bus_remove_device+0x2fd/0x410 drivers/base/bus.c:529
device_del+0x6f1/0xbf0 drivers/base/core.c:3581
usb_disable_device+0x407/0x800 drivers/usb/core/message.c:1419
usb_disconnect+0x33a/0x8a0 drivers/usb/core/hub.c:2225
hub_port_connect+0x297/0x27d0 drivers/usb/core/hub.c:5199
hub_port_connect_change+0x5f9/0xc20 drivers/usb/core/hub.c:5488
port_event+0xb67/0x1220 drivers/usb/core/hub.c:5634
hub_event+0x4ed/0xe40 drivers/usb/core/hub.c:5716
process_one_work+0x853/0x1140 kernel/workqueue.c:2298
process_scheduled_works kernel/workqueue.c:2361 [inline]
worker_thread+0xe28/0x1320 kernel/workqueue.c:2447
kthread+0x468/0x490 kernel/kthread.c:327
ret_from_fork+0x1f/0x30
Allocated by task 28245:
kasan_save_stack mm/kasan/common.c:38 [inline]
kasan_set_track mm/kasan/common.c:46 [inline]
set_alloc_info mm/kasan/common.c:434 [inline]
____kasan_kmalloc+0xdc/0x110 mm/kasan/common.c:513
kasan_kmalloc include/linux/kasan.h:269 [inline]
__kmalloc+0x253/0x380 mm/slub.c:4423
kmalloc include/linux/slab.h:595 [inline]
kzalloc include/linux/slab.h:724 [inline]
__spi_alloc_controller+0x33/0x2a0 drivers/spi/spi.c:2665
spi_alloc_master include/linux/spi/spi.h:726 [inline]
msi2500_probe+0x439/0xa10 drivers/media/usb/msi2500/msi2500.c:1223
usb_probe_interface+0x633/0xb40 drivers/usb/core/driver.c:396
call_driver_probe+0x96/0x250
really_probe+0x223/0x9b0 drivers/base/dd.c:596
__driver_probe_device+0x1f8/0x3e0 drivers/base/dd.c:751
driver_probe_device+0x50/0x240 drivers/base/dd.c:781
__device_attach_driver+0x1e1/0x3b0 drivers/base/dd.c:898
bus_for_each_drv+0x18a/0x210 drivers/base/bus.c:427
__device_attach+0x310/0x560 drivers/base/dd.c:969
bus_probe_device+0xb8/0x1f0 drivers/base/bus.c:487
device_add+0x11c8/0x16d0 drivers/base/core.c:3394
usb_set_configuration+0x1a86/0x2100 drivers/usb/core/message.c:2170
usb_generic_driver_probe+0x83/0x140 drivers/usb/core/generic.c:238
usb_probe_device+0x13a/0x260 drivers/usb/core/driver.c:293
call_driver_probe+0x96/0x250
really_probe+0x223/0x9b0 drivers/base/dd.c:596
__driver_probe_device+0x1f8/0x3e0 drivers/base/dd.c:751
driver_probe_device+0x50/0x240 drivers/base/dd.c:781
__device_attach_driver+0x1e1/0x3b0 drivers/base/dd.c:898
bus_for_each_drv+0x18a/0x210 drivers/base/bus.c:427
__device_attach+0x310/0x560 drivers/base/dd.c:969
bus_probe_device+0xb8/0x1f0 drivers/base/bus.c:487
device_add+0x11c8/0x16d0 drivers/base/core.c:3394
usb_new_device+0x108a/0x1940 drivers/usb/core/hub.c:2563
hub_port_connect+0x1075/0x27d0 drivers/usb/core/hub.c:5348
hub_port_connect_change+0x5f9/0xc20 drivers/usb/core/hub.c:5488
port_event+0xb67/0x1220 drivers/usb/core/hub.c:5634
hub_event+0x4ed/0xe40 drivers/usb/core/hub.c:5716
process_one_work+0x853/0x1140 kernel/workqueue.c:2298
worker_thread+0xac1/0x1320 kernel/workqueue.c:2445
kthread+0x468/0x490 kernel/kthread.c:327
ret_from_fork+0x1f/0x30
Freed by task 28245:
kasan_save_stack mm/kasan/common.c:38 [inline]
kasan_set_track+0x4c/0x80 mm/kasan/common.c:46
kasan_set_free_info+0x1f/0x40 mm/kasan/generic.c:370
____kasan_slab_free+0x10d/0x150 mm/kasan/common.c:366
kasan_slab_free include/linux/kasan.h:235 [inline]
slab_free_hook mm/slub.c:1723 [inline]
slab_free_freelist_hook+0x12e/0x1a0 mm/slub.c:1749
slab_free mm/slub.c:3513 [inline]
kfree+0xe1/0x330 mm/slub.c:4561
device_release+0x98/0x1c0
kobject_cleanup+0x1c0/0x280 lib/kobject.c:705
spi_unregister_controller+0x272/0x340 drivers/spi/spi.c:3106
msi2500_disconnect+0xbf/0x120 drivers/media/usb/msi2500/msi2500.c:577
usb_unbind_interface+0x1f2/0x860 drivers/usb/core/driver.c:458
__device_release_driver drivers/base/dd.c:1205 [inline]
device_release_driver_internal+0x523/0x7b0 drivers/base/dd.c:1236
bus_remove_device+0x2fd/0x410 drivers/base/bus.c:529
device_del+0x6f1/0xbf0 drivers/base/core.c:3581
usb_disable_device+0x407/0x800 drivers/usb/core/message.c:1419
usb_disconnect+0x33a/0x8a0 drivers/usb/core/hub.c:2225
hub_port_connect+0x297/0x27d0 drivers/usb/core/hub.c:5199
hub_port_connect_change+0x5f9/0xc20 drivers/usb/core/hub.c:5488
port_event+0xb67/0x1220 drivers/usb/core/hub.c:5634
hub_event+0x4ed/0xe40 drivers/usb/core/hub.c:5716
process_one_work+0x853/0x1140 kernel/workqueue.c:2298
process_scheduled_works kernel/workqueue.c:2361 [inline]
worker_thread+0xe28/0x1320 kernel/workqueue.c:2447
kthread+0x468/0x490 kernel/kthread.c:327
ret_from_fork+0x1f/0x30
The buggy address belongs to the object at ffff8880895c8000
which belongs to the cache kmalloc-4k of size 4096
The buggy address is located 1536 bytes inside of
4096-byte region [ffff8880895c8000, ffff8880895c9000)
The buggy address belongs to the page:
page:ffffea0002257200 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x895c8
head:ffffea0002257200 order:3 compound_mapcount:0 compound_pincount:0
flags: 0xfff00000010200(slab|head|node=0|zone=1|lastcpupid=0x7ff)
raw: 00fff00000010200 0000000000000000 dead000000000122 ffff888011842140
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 0x1d20c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC|__GFP_HARDWALL), pid 28245, ts 1571866391230, free_ts 1571851223976
prep_new_page mm/page_alloc.c:2418 [inline]
get_page_from_freelist+0x729/0x9e0 mm/page_alloc.c:4149
__alloc_pages+0x255/0x580 mm/page_alloc.c:5369
alloc_slab_page mm/slub.c:1793 [inline]
allocate_slab+0xcc/0x4d0 mm/slub.c:1930
new_slab mm/slub.c:1993 [inline]
___slab_alloc+0x41e/0xc40 mm/slub.c:3022
__slab_alloc mm/slub.c:3109 [inline]
slab_alloc_node mm/slub.c:3200 [inline]
slab_alloc mm/slub.c:3242 [inline]
__kmalloc+0x2eb/0x380 mm/slub.c:4419
kmalloc include/linux/slab.h:595 [inline]
kzalloc include/linux/slab.h:724 [inline]
__spi_alloc_controller+0x33/0x2a0 drivers/spi/spi.c:2665
spi_alloc_master include/linux/spi/spi.h:726 [inline]
msi2500_probe+0x439/0xa10 drivers/media/usb/msi2500/msi2500.c:1223
usb_probe_interface+0x633/0xb40 drivers/usb/core/driver.c:396
call_driver_probe+0x96/0x250
really_probe+0x223/0x9b0 drivers/base/dd.c:596
__driver_probe_device+0x1f8/0x3e0 drivers/base/dd.c:751
driver_probe_device+0x50/0x240 drivers/base/dd.c:781
__device_attach_driver+0x1e1/0x3b0 drivers/base/dd.c:898
bus_for_each_drv+0x18a/0x210 drivers/base/bus.c:427
__device_attach+0x310/0x560 drivers/base/dd.c:969
bus_probe_device+0xb8/0x1f0 drivers/base/bus.c:487
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+0xd1c/0xe00 mm/page_alloc.c:1389
free_unref_page_prepare mm/page_alloc.c:3309 [inline]
free_unref_page+0x7d/0x580 mm/page_alloc.c:3388
free_slab mm/slub.c:2033 [inline]
discard_slab mm/slub.c:2039 [inline]
__unfreeze_partials+0x1ab/0x200 mm/slub.c:2527
put_cpu_partial+0x116/0x180 mm/slub.c:2603
do_slab_free mm/slub.c:3501 [inline]
___cache_free+0xe6/0x120 mm/slub.c:3520
qlist_free_all mm/kasan/quarantine.c:165 [inline]
kasan_quarantine_reduce+0x151/0x1c0 mm/kasan/quarantine.c:272
__kasan_slab_alloc+0x2f/0xf0 mm/kasan/common.c:444
kasan_slab_alloc include/linux/kasan.h:259 [inline]
slab_post_alloc_hook mm/slab.h:519 [inline]
slab_alloc_node mm/slub.c:3234 [inline]
slab_alloc mm/slub.c:3242 [inline]
kmem_cache_alloc+0x1c9/0x310 mm/slub.c:3247
ptlock_alloc+0x1c/0x60 mm/memory.c:5448
ptlock_init include/linux/mm.h:2332 [inline]
pgtable_pte_page_ctor include/linux/mm.h:2359 [inline]
__pte_alloc_one include/asm-generic/pgalloc.h:66 [inline]
pte_alloc_one+0xd1/0x360 arch/x86/mm/pgtable.c:33
__pte_alloc+0x75/0x210 mm/memory.c:464
copy_pte_range+0x29bc/0x30c0 mm/memory.c:1024
copy_pmd_range mm/memory.c:1159 [inline]
copy_pud_range mm/memory.c:1196 [inline]
copy_p4d_range mm/memory.c:1220 [inline]
copy_page_range+0xce6/0x1140 mm/memory.c:1293
dup_mmap+0xa87/0xfd0 kernel/fork.c:609
dup_mm+0x8c/0x310 kernel/fork.c:1450
copy_mm kernel/fork.c:1502 [inline]
copy_process+0x28d7/0x5ca0 kernel/fork.c:2191
Memory state around the buggy address:
ffff8880895c8500: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff8880895c8580: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff8880895c8600: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
^
ffff8880895c8680: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff8880895c8700: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================