usb 1-1: ucan: probing device on interface #0 ================================================================== BUG: KASAN: slab-out-of-bounds in sized_strscpy+0x2a2/0x2cc lib/string.c:182 Read of size 1 at addr ffffaf801cffb5c0 by task kworker/0:3/3804 CPU: 0 UID: 0 PID: 3804 Comm: kworker/0:3 Not tainted 6.14.0-rc1-syzkaller-g245aece3750d #0 Hardware name: riscv-virtio,qemu (DT) Workqueue: usb_hub_wq hub_event Call Trace: [] dump_backtrace+0x2e/0x3c arch/riscv/kernel/stacktrace.c:132 [] show_stack+0x30/0x3c arch/riscv/kernel/stacktrace.c:138 [] __dump_stack lib/dump_stack.c:94 [inline] [] dump_stack_lvl+0x12e/0x1a6 lib/dump_stack.c:120 [] print_address_description mm/kasan/report.c:378 [inline] [] print_report+0x28e/0x5aa mm/kasan/report.c:489 [] kasan_report+0xf0/0x214 mm/kasan/report.c:602 [] __asan_report_load1_noabort+0x12/0x1a mm/kasan/report_generic.c:378 [] sized_strscpy+0x2a2/0x2cc lib/string.c:182 [] ucan_probe+0x1682/0x178c drivers/net/can/usb/ucan.c:1535 [] usb_probe_interface+0x2d6/0x8c4 drivers/usb/core/driver.c:396 [] call_driver_probe drivers/base/dd.c:579 [inline] [] really_probe+0x232/0x9be drivers/base/dd.c:658 [] __driver_probe_device+0x1d4/0x3f2 drivers/base/dd.c:800 [] driver_probe_device+0x60/0x1ce drivers/base/dd.c:830 [] __device_attach_driver+0x1e2/0x2fc drivers/base/dd.c:958 [] bus_for_each_drv+0x142/0x1da drivers/base/bus.c:462 [] __device_attach+0x1c4/0x462 drivers/base/dd.c:1030 [] device_initial_probe+0x1c/0x26 drivers/base/dd.c:1079 [] bus_probe_device+0x15c/0x192 drivers/base/bus.c:537 [] device_add+0x10da/0x181c drivers/base/core.c:3665 [] usb_set_configuration+0xf08/0x19dc drivers/usb/core/message.c:2210 [] usb_generic_driver_probe+0xae/0x128 drivers/usb/core/generic.c:250 [] usb_probe_device+0xd6/0x360 drivers/usb/core/driver.c:291 [] call_driver_probe drivers/base/dd.c:579 [inline] [] really_probe+0x232/0x9be drivers/base/dd.c:658 [] __driver_probe_device+0x1d4/0x3f2 drivers/base/dd.c:800 [] driver_probe_device+0x60/0x1ce drivers/base/dd.c:830 [] __device_attach_driver+0x1e2/0x2fc drivers/base/dd.c:958 [] bus_for_each_drv+0x142/0x1da drivers/base/bus.c:462 [] __device_attach+0x1c4/0x462 drivers/base/dd.c:1030 [] device_initial_probe+0x1c/0x26 drivers/base/dd.c:1079 [] bus_probe_device+0x15c/0x192 drivers/base/bus.c:537 [] device_add+0x10da/0x181c drivers/base/core.c:3665 [] usb_new_device+0x964/0x1778 drivers/usb/core/hub.c:2652 [] hub_port_connect drivers/usb/core/hub.c:5523 [inline] [] hub_port_connect_change drivers/usb/core/hub.c:5663 [inline] [] port_event drivers/usb/core/hub.c:5823 [inline] [] hub_event+0x2716/0x48de drivers/usb/core/hub.c:5905 [] process_one_work+0x96a/0x1f3a kernel/workqueue.c:3236 [] process_scheduled_works kernel/workqueue.c:3317 [inline] [] worker_thread+0x5be/0xdc6 kernel/workqueue.c:3398 [] kthread+0x37e/0x7b6 kernel/kthread.c:464 [] ret_from_fork+0xe/0x18 arch/riscv/kernel/entry.S:327 Allocated by task 3804: stack_trace_save+0xa0/0xd2 kernel/stacktrace.c:122 kasan_save_stack+0x3e/0x6a mm/kasan/common.c:47 kasan_save_track+0x16/0x28 mm/kasan/common.c:68 kasan_save_alloc_info+0x30/0x3e mm/kasan/generic.c:562 poison_kmalloc_redzone mm/kasan/common.c:377 [inline] __kasan_kmalloc+0xa0/0xa6 mm/kasan/common.c:394 kasan_kmalloc include/linux/kasan.h:260 [inline] __do_kmalloc_node mm/slub.c:4294 [inline] __kmalloc_node_track_caller_noprof+0x258/0x5ec mm/slub.c:4313 alloc_dr drivers/base/devres.c:119 [inline] devm_kmalloc+0x9a/0x1fe drivers/base/devres.c:843 devm_kzalloc include/linux/device.h:328 [inline] ucan_probe+0x57e/0x178c drivers/net/can/usb/ucan.c:1401 usb_probe_interface+0x2d6/0x8c4 drivers/usb/core/driver.c:396 call_driver_probe drivers/base/dd.c:579 [inline] really_probe+0x232/0x9be drivers/base/dd.c:658 __driver_probe_device+0x1d4/0x3f2 drivers/base/dd.c:800 driver_probe_device+0x60/0x1ce drivers/base/dd.c:830 __device_attach_driver+0x1e2/0x2fc drivers/base/dd.c:958 bus_for_each_drv+0x142/0x1da drivers/base/bus.c:462 __device_attach+0x1c4/0x462 drivers/base/dd.c:1030 device_initial_probe+0x1c/0x26 drivers/base/dd.c:1079 bus_probe_device+0x15c/0x192 drivers/base/bus.c:537 device_add+0x10da/0x181c drivers/base/core.c:3665 usb_set_configuration+0xf08/0x19dc drivers/usb/core/message.c:2210 usb_generic_driver_probe+0xae/0x128 drivers/usb/core/generic.c:250 usb_probe_device+0xd6/0x360 drivers/usb/core/driver.c:291 call_driver_probe drivers/base/dd.c:579 [inline] really_probe+0x232/0x9be drivers/base/dd.c:658 __driver_probe_device+0x1d4/0x3f2 drivers/base/dd.c:800 driver_probe_device+0x60/0x1ce drivers/base/dd.c:830 __device_attach_driver+0x1e2/0x2fc drivers/base/dd.c:958 bus_for_each_drv+0x142/0x1da drivers/base/bus.c:462 __device_attach+0x1c4/0x462 drivers/base/dd.c:1030 device_initial_probe+0x1c/0x26 drivers/base/dd.c:1079 bus_probe_device+0x15c/0x192 drivers/base/bus.c:537 device_add+0x10da/0x181c drivers/base/core.c:3665 usb_new_device+0x964/0x1778 drivers/usb/core/hub.c:2652 hub_port_connect drivers/usb/core/hub.c:5523 [inline] hub_port_connect_change drivers/usb/core/hub.c:5663 [inline] port_event drivers/usb/core/hub.c:5823 [inline] hub_event+0x2716/0x48de drivers/usb/core/hub.c:5905 process_one_work+0x96a/0x1f3a kernel/workqueue.c:3236 process_scheduled_works kernel/workqueue.c:3317 [inline] worker_thread+0x5be/0xdc6 kernel/workqueue.c:3398 kthread+0x37e/0x7b6 kernel/kthread.c:464 ret_from_fork+0xe/0x18 arch/riscv/kernel/entry.S:327 The buggy address belongs to the object at ffffaf801cffb500 which belongs to the cache kmalloc-192 of size 192 The buggy address is located 0 bytes to the right of allocated 192-byte region [ffffaf801cffb500, ffffaf801cffb5c0) The buggy address belongs to the physical page: page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x9cffb flags: 0xffe000000000000(node=0|zone=0|lastcpupid=0x7ff) page_type: f5(slab) raw: 0ffe000000000000 ffffaf80114013c0 ffff8d8000791400 dead000000000004 raw: 0000000000000000 0000000000100010 00000000f5000000 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 0x52cc0(GFP_KERNEL|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP), pid 1, tgid 1 (swapper/0), ts 61030555000, free_ts 0 __set_page_owner+0xa2/0x710 mm/page_owner.c:320 set_page_owner include/linux/page_owner.h:32 [inline] post_alloc_hook+0xea/0x1e2 mm/page_alloc.c:1551 prep_new_page mm/page_alloc.c:1559 [inline] get_page_from_freelist+0xf78/0x2bd6 mm/page_alloc.c:3477 __alloc_frozen_pages_noprof+0x1e8/0x20fc mm/page_alloc.c:4739 alloc_pages_mpol+0x1fa/0x5b8 mm/mempolicy.c:2270 alloc_frozen_pages_noprof+0x174/0x2f0 mm/mempolicy.c:2341 alloc_slab_page mm/slub.c:2423 [inline] allocate_slab mm/slub.c:2587 [inline] new_slab+0x26a/0x340 mm/slub.c:2640 ___slab_alloc+0xaf4/0x1290 mm/slub.c:3826 __slab_alloc.constprop.0+0x60/0xb0 mm/slub.c:3916 __slab_alloc_node mm/slub.c:3991 [inline] slab_alloc_node mm/slub.c:4152 [inline] __kmalloc_cache_noprof+0xd4/0x3f8 mm/slub.c:4320 kmalloc_noprof include/linux/slab.h:901 [inline] kzalloc_noprof include/linux/slab.h:1037 [inline] call_usermodehelper_setup+0xae/0x2e0 kernel/umh.c:362 kobject_uevent_env+0xce8/0x14e6 lib/kobject_uevent.c:628 kobject_uevent+0x22/0x2e lib/kobject_uevent.c:656 kernel_add_sysfs_param kernel/params.c:821 [inline] param_sysfs_builtin kernel/params.c:856 [inline] param_sysfs_builtin_init+0x32e/0x3a4 kernel/params.c:990 do_one_initcall+0x1a2/0xae4 init/main.c:1257 do_initcall_level init/main.c:1319 [inline] do_initcalls init/main.c:1335 [inline] do_basic_setup init/main.c:1354 [inline] kernel_init_freeable+0x6ec/0x792 init/main.c:1568 page_owner free stack trace missing Memory state around the buggy address: ffffaf801cffb480: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc ffffaf801cffb500: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 >ffffaf801cffb580: 00 00 00 00 00 00 00 00 fc fc fc fc fc fc fc fc ^ ffffaf801cffb600: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffffaf801cffb680: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc ==================================================================