input: HID 5543:0047 Dial as /devices/platform/dummy_hcd.0/usb1/1-1/1-1:0.0/0003:5543:0047.0001/input/input7 uclogic 0003:5543:0047.0001: input,hidraw0: USB HID v0.00 Keypad [HID 5543:0047] on usb-dummy_hcd.0-1/input0 usb 1-1: USB disconnect, device number 2 ================================================================== BUG: KASAN: slab-use-after-free in string_nocheck lib/vsprintf.c:644 [inline] BUG: KASAN: slab-use-after-free in string+0x2a5/0x330 lib/vsprintf.c:726 Read of size 1 at addr ffff88811848c6a8 by task kworker/0:3/3037 CPU: 0 PID: 3037 Comm: kworker/0:3 Not tainted 6.5.0-rc4-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 07/26/2023 Workqueue: usb_hub_wq hub_event Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0x3d/0x60 lib/dump_stack.c:106 print_address_description mm/kasan/report.c:364 [inline] print_report+0xc4/0x620 mm/kasan/report.c:475 kasan_report+0xda/0x110 mm/kasan/report.c:588 string_nocheck lib/vsprintf.c:644 [inline] string+0x2a5/0x330 lib/vsprintf.c:726 vsnprintf+0xa01/0x15c0 lib/vsprintf.c:2817 add_uevent_var+0x150/0x2c0 lib/kobject_uevent.c:665 input_dev_uevent+0x145/0x710 drivers/input/input.c:1691 dev_uevent+0x28e/0x6c0 drivers/base/core.c:2599 kobject_uevent_env+0x52c/0x1410 lib/kobject_uevent.c:557 device_del+0x5c1/0x9a0 drivers/base/core.c:3832 input_unregister_device+0x7f/0xb0 drivers/input/input.c:2440 hidinput_disconnect+0x13f/0x3d0 drivers/hid/hid-input.c:2369 hid_disconnect+0xe8/0x150 drivers/hid/hid-core.c:2273 hid_hw_stop+0xe/0x70 drivers/hid/hid-core.c:2322 uclogic_remove+0x42/0x90 drivers/hid/hid-uclogic-core.c:485 hid_device_remove+0xbc/0x220 drivers/hid/hid-core.c:2682 __device_release_driver drivers/base/dd.c:1272 [inline] device_release_driver_internal+0x370/0x530 drivers/base/dd.c:1295 bus_remove_device+0x1ed/0x3e0 drivers/base/bus.c:574 device_del+0x3de/0x9a0 drivers/base/core.c:3814 hid_remove_device drivers/hid/hid-core.c:2859 [inline] hid_destroy_device+0xbe/0x130 drivers/hid/hid-core.c:2879 usbhid_disconnect+0x92/0xc0 drivers/hid/usbhid/hid-core.c:1456 usb_unbind_interface+0x17d/0x7b0 drivers/usb/core/driver.c:458 __device_release_driver drivers/base/dd.c:1272 [inline] device_release_driver_internal+0x370/0x530 drivers/base/dd.c:1295 bus_remove_device+0x1ed/0x3e0 drivers/base/bus.c:574 device_del+0x3de/0x9a0 drivers/base/core.c:3814 usb_disable_device+0x290/0x680 drivers/usb/core/message.c:1420 usb_disconnect+0x272/0x880 drivers/usb/core/hub.c:2253 hub_port_connect drivers/usb/core/hub.c:5261 [inline] hub_port_connect_change drivers/usb/core/hub.c:5566 [inline] port_event drivers/usb/core/hub.c:5726 [inline] hub_event+0x1894/0x45e0 drivers/usb/core/hub.c:5808 process_one_work+0x922/0x1370 kernel/workqueue.c:2597 process_scheduled_works kernel/workqueue.c:2664 [inline] worker_thread+0x58d/0xe40 kernel/workqueue.c:2750 kthread+0x278/0x330 kernel/kthread.c:389 ret_from_fork+0x2c/0x70 arch/x86/kernel/process.c:145 ret_from_fork_asm+0x11/0x20 arch/x86/entry/entry_64.S:304 Allocated by task 3037: kasan_save_stack+0x33/0x50 mm/kasan/common.c:45 kasan_set_track+0x25/0x30 mm/kasan/common.c:52 ____kasan_kmalloc mm/kasan/common.c:374 [inline] __kasan_kmalloc+0xa2/0xb0 mm/kasan/common.c:383 kasan_kmalloc include/linux/kasan.h:196 [inline] __do_kmalloc_node mm/slab_common.c:985 [inline] __kmalloc_node_track_caller+0x5e/0x160 mm/slab_common.c:1005 alloc_dr drivers/base/devres.c:119 [inline] devm_kmalloc+0x75/0x1e0 drivers/base/devres.c:829 devm_kzalloc include/linux/device.h:314 [inline] uclogic_input_configured+0x1c8/0x5f0 drivers/hid/hid-uclogic-core.c:151 hidinput_connect+0x14fc/0x25a0 drivers/hid/hid-input.c:2327 hid_connect+0xfe4/0x1520 drivers/hid/hid-core.c:2187 hid_hw_start drivers/hid/hid-core.c:2302 [inline] hid_hw_start+0x75/0xf0 drivers/hid/hid-core.c:2293 uclogic_probe+0x1cb/0x2d0 drivers/hid/hid-uclogic-core.c:221 __hid_device_probe drivers/hid/hid-core.c:2626 [inline] hid_device_probe+0x272/0x3d0 drivers/hid/hid-core.c:2663 call_driver_probe drivers/base/dd.c:579 [inline] really_probe+0x1bf/0xb20 drivers/base/dd.c:658 __driver_probe_device+0x187/0x440 drivers/base/dd.c:800 driver_probe_device+0x45/0x110 drivers/base/dd.c:830 __device_attach_driver+0x152/0x260 drivers/base/dd.c:958 bus_for_each_drv+0x110/0x190 drivers/base/bus.c:457 __device_attach+0x194/0x3a0 drivers/base/dd.c:1030 bus_probe_device+0x12b/0x170 drivers/base/bus.c:532 device_add+0xee3/0x1720 drivers/base/core.c:3625 hid_add_device+0x307/0x900 drivers/hid/hid-core.c:2809 usbhid_probe+0xab8/0x1080 drivers/hid/usbhid/hid-core.c:1429 usb_probe_interface+0x279/0x820 drivers/usb/core/driver.c:396 call_driver_probe drivers/base/dd.c:579 [inline] really_probe+0x1bf/0xb20 drivers/base/dd.c:658 __driver_probe_device+0x187/0x440 drivers/base/dd.c:800 driver_probe_device+0x45/0x110 drivers/base/dd.c:830 __device_attach_driver+0x152/0x260 drivers/base/dd.c:958 bus_for_each_drv+0x110/0x190 drivers/base/bus.c:457 __device_attach+0x194/0x3a0 drivers/base/dd.c:1030 bus_probe_device+0x12b/0x170 drivers/base/bus.c:532 device_add+0xee3/0x1720 drivers/base/core.c:3625 usb_set_configuration+0xdc1/0x1830 drivers/usb/core/message.c:2211 usb_generic_driver_probe+0x84/0xd0 drivers/usb/core/generic.c:238 usb_probe_device+0x9f/0x240 drivers/usb/core/driver.c:293 call_driver_probe drivers/base/dd.c:579 [inline] really_probe+0x1bf/0xb20 drivers/base/dd.c:658 __driver_probe_device+0x187/0x440 drivers/base/dd.c:800 driver_probe_device+0x45/0x110 drivers/base/dd.c:830 __device_attach_driver+0x152/0x260 drivers/base/dd.c:958 bus_for_each_drv+0x110/0x190 drivers/base/bus.c:457 __device_attach+0x194/0x3a0 drivers/base/dd.c:1030 bus_probe_device+0x12b/0x170 drivers/base/bus.c:532 device_add+0xee3/0x1720 drivers/base/core.c:3625 usb_new_device+0xc70/0x17b0 drivers/usb/core/hub.c:2590 hub_port_connect drivers/usb/core/hub.c:5422 [inline] hub_port_connect_change drivers/usb/core/hub.c:5566 [inline] port_event drivers/usb/core/hub.c:5726 [inline] hub_event+0x26da/0x45e0 drivers/usb/core/hub.c:5808 process_one_work+0x922/0x1370 kernel/workqueue.c:2597 worker_thread+0xfb/0xe40 kernel/workqueue.c:2748 kthread+0x278/0x330 kernel/kthread.c:389 ret_from_fork+0x2c/0x70 arch/x86/kernel/process.c:145 ret_from_fork_asm+0x11/0x20 arch/x86/entry/entry_64.S:304 Freed by task 3037: kasan_save_stack+0x33/0x50 mm/kasan/common.c:45 kasan_set_track+0x25/0x30 mm/kasan/common.c:52 kasan_save_free_info+0x2b/0x40 mm/kasan/generic.c:522 ____kasan_slab_free mm/kasan/common.c:236 [inline] ____kasan_slab_free+0x15e/0x1b0 mm/kasan/common.c:200 kasan_slab_free include/linux/kasan.h:162 [inline] slab_free_hook mm/slub.c:1792 [inline] slab_free_freelist_hook+0x10b/0x1e0 mm/slub.c:1818 slab_free mm/slub.c:3801 [inline] __kmem_cache_free+0xba/0x340 mm/slub.c:3814 release_nodes drivers/base/devres.c:506 [inline] devres_release_all+0x172/0x210 drivers/base/devres.c:535 device_del+0x5a7/0x9a0 drivers/base/core.c:3829 input_unregister_device+0x7f/0xb0 drivers/input/input.c:2440 hidinput_disconnect+0x13f/0x3d0 drivers/hid/hid-input.c:2369 hid_disconnect+0xe8/0x150 drivers/hid/hid-core.c:2273 hid_hw_stop+0xe/0x70 drivers/hid/hid-core.c:2322 uclogic_remove+0x42/0x90 drivers/hid/hid-uclogic-core.c:485 hid_device_remove+0xbc/0x220 drivers/hid/hid-core.c:2682 __device_release_driver drivers/base/dd.c:1272 [inline] device_release_driver_internal+0x370/0x530 drivers/base/dd.c:1295 bus_remove_device+0x1ed/0x3e0 drivers/base/bus.c:574 device_del+0x3de/0x9a0 drivers/base/core.c:3814 hid_remove_device drivers/hid/hid-core.c:2859 [inline] hid_destroy_device+0xbe/0x130 drivers/hid/hid-core.c:2879 usbhid_disconnect+0x92/0xc0 drivers/hid/usbhid/hid-core.c:1456 usb_unbind_interface+0x17d/0x7b0 drivers/usb/core/driver.c:458 __device_release_driver drivers/base/dd.c:1272 [inline] device_release_driver_internal+0x370/0x530 drivers/base/dd.c:1295 bus_remove_device+0x1ed/0x3e0 drivers/base/bus.c:574 device_del+0x3de/0x9a0 drivers/base/core.c:3814 usb_disable_device+0x290/0x680 drivers/usb/core/message.c:1420 usb_disconnect+0x272/0x880 drivers/usb/core/hub.c:2253 hub_port_connect drivers/usb/core/hub.c:5261 [inline] hub_port_connect_change drivers/usb/core/hub.c:5566 [inline] port_event drivers/usb/core/hub.c:5726 [inline] hub_event+0x1894/0x45e0 drivers/usb/core/hub.c:5808 process_one_work+0x922/0x1370 kernel/workqueue.c:2597 process_scheduled_works kernel/workqueue.c:2664 [inline] worker_thread+0x58d/0xe40 kernel/workqueue.c:2750 kthread+0x278/0x330 kernel/kthread.c:389 ret_from_fork+0x2c/0x70 arch/x86/kernel/process.c:145 ret_from_fork_asm+0x11/0x20 arch/x86/entry/entry_64.S:304 The buggy address belongs to the object at ffff88811848c680 which belongs to the cache kmalloc-64 of size 64 The buggy address is located 40 bytes inside of freed 64-byte region [ffff88811848c680, ffff88811848c6c0) The buggy address belongs to the physical page: page:ffffea0004612300 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x11848c flags: 0x100000000000200(slab|node=0|zone=2) page_type: 0xffffffff() raw: 0100000000000200 ffff888100041640 dead000000000100 dead000000000122 raw: 0000000000000000 0000000000200020 00000001ffffffff 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 0x12c40(GFP_NOFS|__GFP_NOWARN|__GFP_NORETRY), pid 2572, tgid 2572 (start-stop-daem), ts 7819185710, free_ts 7815662957 set_page_owner include/linux/page_owner.h:31 [inline] post_alloc_hook+0x281/0x2f0 mm/page_alloc.c:1570 prep_new_page mm/page_alloc.c:1577 [inline] get_page_from_freelist+0xfcb/0x31e0 mm/page_alloc.c:3221 __alloc_pages+0x1d0/0x470 mm/page_alloc.c:4477 alloc_slab_page mm/slub.c:1862 [inline] allocate_slab+0x24e/0x360 mm/slub.c:2009 new_slab mm/slub.c:2062 [inline] ___slab_alloc+0x7a7/0x1000 mm/slub.c:3215 __slab_alloc.constprop.0+0x4d/0x90 mm/slub.c:3314 __slab_alloc_node mm/slub.c:3367 [inline] slab_alloc_node mm/slub.c:3460 [inline] __kmem_cache_alloc_node+0x143/0x390 mm/slub.c:3509 __do_kmalloc_node mm/slab_common.c:984 [inline] __kmalloc+0x4c/0x160 mm/slab_common.c:998 kmalloc include/linux/slab.h:586 [inline] kzalloc include/linux/slab.h:703 [inline] tomoyo_commit_ok+0x1a/0x60 security/tomoyo/memory.c:76 tomoyo_update_domain+0x514/0x7c0 security/tomoyo/domain.c:139 tomoyo_update_path_acl security/tomoyo/file.c:398 [inline] tomoyo_write_file+0x375/0x570 security/tomoyo/file.c:1022 tomoyo_write_domain2+0xdd/0x150 security/tomoyo/common.c:1143 tomoyo_add_entry security/tomoyo/common.c:2033 [inline] tomoyo_supervisor+0x417/0xc40 security/tomoyo/common.c:2094 tomoyo_audit_path_log security/tomoyo/file.c:168 [inline] tomoyo_path_permission security/tomoyo/file.c:587 [inline] tomoyo_path_permission+0x23d/0x330 security/tomoyo/file.c:573 tomoyo_check_open_permission+0x287/0x2b0 security/tomoyo/file.c:777 security_file_open+0x4f/0x80 security/security.c:2797 page last free stack trace: reset_page_owner include/linux/page_owner.h:24 [inline] free_pages_prepare mm/page_alloc.c:1161 [inline] free_unref_page_prepare+0x5ac/0xcf0 mm/page_alloc.c:2348 free_unref_page_list+0xe6/0xaa0 mm/page_alloc.c:2489 release_pages+0x25c/0x10c0 mm/swap.c:1042 tlb_batch_pages_flush+0x79/0x140 mm/mmu_gather.c:97 tlb_flush_mmu_free mm/mmu_gather.c:292 [inline] tlb_flush_mmu mm/mmu_gather.c:299 [inline] tlb_finish_mmu+0x114/0x6c0 mm/mmu_gather.c:391 exit_mmap+0x26a/0x730 mm/mmap.c:3215 __mmput+0xb7/0x3e0 kernel/fork.c:1348 exec_mmap fs/exec.c:1036 [inline] begin_new_exec+0xe05/0x2900 fs/exec.c:1295 load_elf_binary+0x659/0x4500 fs/binfmt_elf.c:1001 search_binary_handler fs/exec.c:1738 [inline] exec_binprm fs/exec.c:1780 [inline] bprm_execve fs/exec.c:1855 [inline] bprm_execve+0x686/0x1430 fs/exec.c:1811 do_execveat_common.isra.0+0x4bc/0x690 fs/exec.c:1963 do_execve fs/exec.c:2037 [inline] __do_sys_execve fs/exec.c:2113 [inline] __se_sys_execve fs/exec.c:2108 [inline] __x64_sys_execve+0x87/0xb0 fs/exec.c:2108 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x38/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd Memory state around the buggy address: ffff88811848c580: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc ffff88811848c600: 00 00 00 00 00 00 fc fc fc fc fc fc fc fc fc fc >ffff88811848c680: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc ^ ffff88811848c700: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc ffff88811848c780: 00 00 00 00 00 00 07 fc fc fc fc fc fc fc fc fc ==================================================================