usb 1-1: USB disconnect, device number 4 ================================================================== BUG: KASAN: slab-use-after-free in hdm_disconnect+0x1bc/0x1e0 drivers/most/most_usb.c:1125 Read of size 8 at addr ffff00001402d8b0 by task kworker/0:0/9 CPU: 0 UID: 0 PID: 9 Comm: kworker/0:0 Not tainted 6.17.0-rc1-syzkaller-00199-gdfd4b508c8c6 #0 PREEMPT Hardware name: linux,dummy-virt (DT) Workqueue: usb_hub_wq hub_event Call trace: show_stack+0x18/0x24 arch/arm64/kernel/stacktrace.c:499 (C) __dump_stack lib/dump_stack.c:94 [inline] dump_stack_lvl+0xa4/0xf4 lib/dump_stack.c:120 print_address_description mm/kasan/report.c:378 [inline] print_report+0xf4/0x5a0 mm/kasan/report.c:482 kasan_report+0xc8/0x108 mm/kasan/report.c:595 __asan_report_load8_noabort+0x20/0x2c mm/kasan/report_generic.c:381 hdm_disconnect+0x1bc/0x1e0 drivers/most/most_usb.c:1125 usb_unbind_interface+0x168/0x71c drivers/usb/core/driver.c:458 device_remove drivers/base/dd.c:571 [inline] device_remove+0x100/0x14c drivers/base/dd.c:563 __device_release_driver drivers/base/dd.c:1274 [inline] device_release_driver_internal+0x310/0x47c drivers/base/dd.c:1297 device_release_driver+0x18/0x24 drivers/base/dd.c:1320 bus_remove_device+0x1a4/0x348 drivers/base/bus.c:579 device_del+0x2d0/0x7b4 drivers/base/core.c:3878 usb_disable_device+0x240/0x5ac drivers/usb/core/message.c:1418 usb_disconnect+0x22c/0x7ec drivers/usb/core/hub.c:2344 hub_port_connect drivers/usb/core/hub.c:5406 [inline] hub_port_connect_change drivers/usb/core/hub.c:5706 [inline] port_event drivers/usb/core/hub.c:5870 [inline] hub_event+0x10a4/0x365c drivers/usb/core/hub.c:5952 process_one_work+0x7cc/0x18d4 kernel/workqueue.c:3236 process_scheduled_works kernel/workqueue.c:3319 [inline] worker_thread+0x734/0xb84 kernel/workqueue.c:3400 kthread+0x348/0x5fc kernel/kthread.c:463 ret_from_fork+0x10/0x20 arch/arm64/kernel/entry.S:860 Allocated by task 970: kasan_save_stack+0x3c/0x64 mm/kasan/common.c:47 kasan_save_track+0x20/0x3c mm/kasan/common.c:68 kasan_save_alloc_info+0x40/0x54 mm/kasan/generic.c:562 poison_kmalloc_redzone mm/kasan/common.c:388 [inline] __kasan_kmalloc+0xb8/0xbc mm/kasan/common.c:405 kasan_kmalloc include/linux/kasan.h:260 [inline] __kmalloc_cache_noprof+0x1b4/0x3d0 mm/slub.c:4396 kmalloc_noprof include/linux/slab.h:905 [inline] kzalloc_noprof include/linux/slab.h:1039 [inline] hdm_probe+0x94/0x13a0 drivers/most/most_usb.c:959 usb_probe_interface+0x22c/0x870 drivers/usb/core/driver.c:396 call_driver_probe drivers/base/dd.c:581 [inline] really_probe+0x180/0x7d8 drivers/base/dd.c:659 __driver_probe_device+0x15c/0x364 drivers/base/dd.c:801 driver_probe_device+0x5c/0x16c drivers/base/dd.c:831 __device_attach_driver+0x16c/0x270 drivers/base/dd.c:959 bus_for_each_drv+0x104/0x18c drivers/base/bus.c:462 __device_attach+0x168/0x35c drivers/base/dd.c:1031 device_initial_probe+0x14/0x20 drivers/base/dd.c:1080 bus_probe_device+0x124/0x15c drivers/base/bus.c:537 device_add+0xc30/0x12cc drivers/base/core.c:3689 usb_set_configuration+0xbb8/0x15b8 drivers/usb/core/message.c:2210 usb_generic_driver_probe+0x8c/0xc0 drivers/usb/core/generic.c:250 usb_probe_device+0xa4/0x2f4 drivers/usb/core/driver.c:291 call_driver_probe drivers/base/dd.c:581 [inline] really_probe+0x180/0x7d8 drivers/base/dd.c:659 __driver_probe_device+0x15c/0x364 drivers/base/dd.c:801 driver_probe_device+0x5c/0x16c drivers/base/dd.c:831 __device_attach_driver+0x16c/0x270 drivers/base/dd.c:959 bus_for_each_drv+0x104/0x18c drivers/base/bus.c:462 __device_attach+0x168/0x35c drivers/base/dd.c:1031 device_initial_probe+0x14/0x20 drivers/base/dd.c:1080 bus_probe_device+0x124/0x15c drivers/base/bus.c:537 device_add+0xc30/0x12cc drivers/base/core.c:3689 usb_new_device+0x778/0x16cc drivers/usb/core/hub.c:2694 hub_port_connect drivers/usb/core/hub.c:5566 [inline] hub_port_connect_change drivers/usb/core/hub.c:5706 [inline] port_event drivers/usb/core/hub.c:5870 [inline] hub_event+0x1d70/0x365c drivers/usb/core/hub.c:5952 process_one_work+0x7cc/0x18d4 kernel/workqueue.c:3236 process_scheduled_works kernel/workqueue.c:3319 [inline] worker_thread+0x734/0xb84 kernel/workqueue.c:3400 kthread+0x348/0x5fc kernel/kthread.c:463 ret_from_fork+0x10/0x20 arch/arm64/kernel/entry.S:860 Freed by task 9: kasan_save_stack+0x3c/0x64 mm/kasan/common.c:47 kasan_save_track+0x20/0x3c mm/kasan/common.c:68 kasan_save_free_info+0x4c/0x74 mm/kasan/generic.c:576 poison_slab_object mm/kasan/common.c:243 [inline] __kasan_slab_free+0x58/0x78 mm/kasan/common.c:275 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+0x1bc/0x444 mm/slub.c:4879 release_mdev+0x10/0x1c drivers/most/most_usb.c:932 device_release+0x80/0x1e8 drivers/base/core.c:2561 kobject_cleanup lib/kobject.c:689 [inline] kobject_release lib/kobject.c:720 [inline] kref_put include/linux/kref.h:65 [inline] kobject_put+0x17c/0x430 lib/kobject.c:737 put_device drivers/base/core.c:3797 [inline] device_unregister+0x2c/0xbc drivers/base/core.c:3920 most_deregister_interface+0x2d8/0x46c drivers/most/core.c:1402 hdm_disconnect+0xcc/0x1e0 drivers/most/most_usb.c:1123 usb_unbind_interface+0x168/0x71c drivers/usb/core/driver.c:458 device_remove drivers/base/dd.c:571 [inline] device_remove+0x100/0x14c drivers/base/dd.c:563 __device_release_driver drivers/base/dd.c:1274 [inline] device_release_driver_internal+0x310/0x47c drivers/base/dd.c:1297 device_release_driver+0x18/0x24 drivers/base/dd.c:1320 bus_remove_device+0x1a4/0x348 drivers/base/bus.c:579 device_del+0x2d0/0x7b4 drivers/base/core.c:3878 usb_disable_device+0x240/0x5ac drivers/usb/core/message.c:1418 usb_disconnect+0x22c/0x7ec drivers/usb/core/hub.c:2344 hub_port_connect drivers/usb/core/hub.c:5406 [inline] hub_port_connect_change drivers/usb/core/hub.c:5706 [inline] port_event drivers/usb/core/hub.c:5870 [inline] hub_event+0x10a4/0x365c drivers/usb/core/hub.c:5952 process_one_work+0x7cc/0x18d4 kernel/workqueue.c:3236 process_scheduled_works kernel/workqueue.c:3319 [inline] worker_thread+0x734/0xb84 kernel/workqueue.c:3400 kthread+0x348/0x5fc kernel/kthread.c:463 ret_from_fork+0x10/0x20 arch/arm64/kernel/entry.S:860 The buggy address belongs to the object at ffff00001402c000 which belongs to the cache kmalloc-8k of size 8192 The buggy address is located 6320 bytes inside of freed 8192-byte region [ffff00001402c000, ffff00001402e000) The buggy address belongs to the physical page: page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x54028 head: order:3 mapcount:0 entire_mapcount:0 nr_pages_mapped:0 pincount:0 flags: 0x1ffc00000000040(head|node=0|zone=0|lastcpupid=0x7ff) page_type: f5(slab) raw: 01ffc00000000040 ffff00000dc02280 fffffdffc0820600 dead000000000002 raw: 0000000000000000 0000000080020002 00000000f5000000 0000000000000000 head: 01ffc00000000040 ffff00000dc02280 fffffdffc0820600 dead000000000002 head: 0000000000000000 0000000080020002 00000000f5000000 0000000000000000 head: 01ffc00000000003 fffffdffc0500a01 00000000ffffffff 00000000ffffffff head: ffffffffffffffff 0000000000000000 00000000ffffffff 0000000000000008 page dumped because: kasan: bad access detected Memory state around the buggy address: ffff00001402d780: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff00001402d800: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff00001402d880: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff00001402d900: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff00001402d980: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ================================================================== ------------[ cut here ]------------ refcount_t: underflow; use-after-free. WARNING: CPU: 0 PID: 9 at lib/refcount.c:28 refcount_warn_saturate+0x138/0x19c lib/refcount.c:28 Modules linked in: CPU: 0 UID: 0 PID: 9 Comm: kworker/0:0 Tainted: G B 6.17.0-rc1-syzkaller-00199-gdfd4b508c8c6 #0 PREEMPT Tainted: [B]=BAD_PAGE Hardware name: linux,dummy-virt (DT) Workqueue: usb_hub_wq hub_event pstate: 60000005 (nZCv daif -PAN -UAO -TCO -DIT -SSBS BTYPE=--) pc : refcount_warn_saturate+0x138/0x19c lib/refcount.c:28 lr : refcount_warn_saturate+0x138/0x19c lib/refcount.c:28 sp : ffff80008d5b7390 x29: ffff80008d5b7390 x28: ffff00001bd05000 x27: ffff00001bd050d8 x26: ffff6000037a0a1b x25: ffff8000886b6480 x24: ffff00001bd050e0 x23: ffff00001bdbe038 x22: 0000000000000004 x21: 1fffe000037b7c07 x20: ffff00001bdbe038 x19: 0000000000000003 x18: 0000000000000000 x17: 0000000000000000 x16: ffff00006a08a4c4 x15: 0000000000000000 x14: 0000000000000000 x13: 0000000000000000 x12: ffff700011ab6ddb x11: 1ffff00011ab6dda x10: ffff700011ab6dda x9 : dfff800000000000 x8 : ffff80008d5b6ed8 x7 : ffff80008d5b7000 x6 : ffff80008d5b6f50 x5 : ffff80008d5b6f38 x4 : 1ffff00011ab6df0 x3 : 1fffe0000d41313e x2 : 0000000000000000 x1 : 0000000000000000 x0 : ffff00000e288000 Call trace: refcount_warn_saturate+0x138/0x19c lib/refcount.c:28 (P) __refcount_sub_and_test include/linux/refcount.h:400 [inline] __refcount_dec_and_test include/linux/refcount.h:432 [inline] refcount_dec_and_test include/linux/refcount.h:450 [inline] kref_put include/linux/kref.h:64 [inline] kobject_put+0x29c/0x430 lib/kobject.c:737 put_device+0x14/0x24 drivers/base/core.c:3797 hdm_disconnect+0x168/0x1e0 drivers/most/most_usb.c:1129 usb_unbind_interface+0x168/0x71c drivers/usb/core/driver.c:458 device_remove drivers/base/dd.c:571 [inline] device_remove+0x100/0x14c drivers/base/dd.c:563 __device_release_driver drivers/base/dd.c:1274 [inline] device_release_driver_internal+0x310/0x47c drivers/base/dd.c:1297 device_release_driver+0x18/0x24 drivers/base/dd.c:1320 bus_remove_device+0x1a4/0x348 drivers/base/bus.c:579 device_del+0x2d0/0x7b4 drivers/base/core.c:3878 usb_disable_device+0x240/0x5ac drivers/usb/core/message.c:1418 usb_disconnect+0x22c/0x7ec drivers/usb/core/hub.c:2344 hub_port_connect drivers/usb/core/hub.c:5406 [inline] hub_port_connect_change drivers/usb/core/hub.c:5706 [inline] port_event drivers/usb/core/hub.c:5870 [inline] hub_event+0x10a4/0x365c drivers/usb/core/hub.c:5952 process_one_work+0x7cc/0x18d4 kernel/workqueue.c:3236 process_scheduled_works kernel/workqueue.c:3319 [inline] worker_thread+0x734/0xb84 kernel/workqueue.c:3400 kthread+0x348/0x5fc kernel/kthread.c:463 ret_from_fork+0x10/0x20 arch/arm64/kernel/entry.S:860 irq event stamp: 3272 hardirqs last enabled at (3271): [] __raw_spin_unlock_irq include/linux/spinlock_api_smp.h:159 [inline] hardirqs last enabled at (3271): [] _raw_spin_unlock_irq+0x30/0x8c kernel/locking/spinlock.c:202 hardirqs last disabled at (3272): [] __schedule+0x2e8/0x3180 kernel/sched/core.c:6845 softirqs last enabled at (2860): [] softirq_handle_end kernel/softirq.c:425 [inline] softirqs last enabled at (2860): [] handle_softirqs+0x88c/0xdb4 kernel/softirq.c:607 softirqs last disabled at (2823): [] __do_softirq+0x14/0x20 kernel/softirq.c:613 ---[ end trace 0000000000000000 ]---