================================================================== BUG: KASAN: use-after-free in hlist_add_head include/linux/list.h:930 [inline] BUG: KASAN: use-after-free in enqueue_timer+0xa6/0x480 kernel/time/timer.c:605 Write of size 8 at addr ffff888121ed48e0 by task kworker/u5:3/591 CPU: 1 PID: 591 Comm: kworker/u5:3 Not tainted 6.1.115-syzkaller-00090-g0d968ced7330 #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/13/2024 Workqueue: hci0 hci_power_on Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0x151/0x1b7 lib/dump_stack.c:106 print_address_description mm/kasan/report.c:284 [inline] print_report+0x158/0x4e0 mm/kasan/report.c:395 kasan_report+0x13c/0x170 mm/kasan/report.c:495 __asan_report_store8_noabort+0x17/0x20 mm/kasan/report_generic.c:356 hlist_add_head include/linux/list.h:930 [inline] enqueue_timer+0xa6/0x480 kernel/time/timer.c:605 internal_add_timer kernel/time/timer.c:634 [inline] __mod_timer+0x8d3/0xcf0 kernel/time/timer.c:1115 schedule_timeout+0x18f/0x390 kernel/time/timer.c:1964 __hci_cmd_sync_sk+0x2ad/0xfa0 net/bluetooth/hci_sync.c:170 __hci_cmd_sync_status_sk net/bluetooth/hci_sync.c:257 [inline] __hci_cmd_sync_status net/bluetooth/hci_sync.c:281 [inline] hci_read_local_features_sync net/bluetooth/hci_sync.c:3456 [inline] hci_init_stage_sync net/bluetooth/hci_sync.c:3367 [inline] hci_init1_sync net/bluetooth/hci_sync.c:3551 [inline] hci_init_sync net/bluetooth/hci_sync.c:4633 [inline] hci_dev_init_sync net/bluetooth/hci_sync.c:4824 [inline] hci_dev_open_sync+0x1351/0x3260 net/bluetooth/hci_sync.c:4904 hci_dev_do_open net/bluetooth/hci_core.c:439 [inline] hci_power_on+0x1a7/0x5e0 net/bluetooth/hci_core.c:945 process_one_work+0x73d/0xcb0 kernel/workqueue.c:2292 worker_thread+0xa5d/0x1260 kernel/workqueue.c:2439 kthread+0x26d/0x300 kernel/kthread.c:376 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:295 Allocated by task 609: kasan_save_stack mm/kasan/common.c:45 [inline] kasan_set_track+0x4b/0x70 mm/kasan/common.c:52 kasan_save_alloc_info+0x1f/0x30 mm/kasan/generic.c:505 ____kasan_kmalloc mm/kasan/common.c:374 [inline] __kasan_kmalloc+0x9c/0xb0 mm/kasan/common.c:383 kasan_kmalloc include/linux/kasan.h:211 [inline] __do_kmalloc_node mm/slab_common.c:936 [inline] __kmalloc+0xb4/0x1e0 mm/slab_common.c:949 kmalloc include/linux/slab.h:562 [inline] kzalloc include/linux/slab.h:693 [inline] hci_alloc_dev_priv+0x27/0x1c00 net/bluetooth/hci_core.c:2436 hci_alloc_dev include/net/bluetooth/hci_core.h:1470 [inline] hci_uart_register_dev drivers/bluetooth/hci_ldisc.c:636 [inline] hci_uart_set_proto drivers/bluetooth/hci_ldisc.c:712 [inline] hci_uart_tty_ioctl+0x3fb/0xa70 drivers/bluetooth/hci_ldisc.c:765 tty_ioctl+0x903/0xc50 drivers/tty/tty_io.c:2785 vfs_ioctl fs/ioctl.c:51 [inline] __do_sys_ioctl fs/ioctl.c:870 [inline] __se_sys_ioctl+0x114/0x190 fs/ioctl.c:856 __x64_sys_ioctl+0x7b/0x90 fs/ioctl.c:856 x64_sys_call+0x98/0x9a0 arch/x86/include/generated/asm/syscalls_64.h:17 do_syscall_x64 arch/x86/entry/common.c:51 [inline] do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:81 entry_SYSCALL_64_after_hwframe+0x68/0xd2 Freed by task 611: kasan_save_stack mm/kasan/common.c:45 [inline] kasan_set_track+0x4b/0x70 mm/kasan/common.c:52 kasan_save_free_info+0x2b/0x40 mm/kasan/generic.c:516 ____kasan_slab_free+0x131/0x180 mm/kasan/common.c:236 __kasan_slab_free+0x11/0x20 mm/kasan/common.c:244 kasan_slab_free include/linux/kasan.h:177 [inline] slab_free_hook mm/slub.c:1724 [inline] slab_free_freelist_hook mm/slub.c:1750 [inline] slab_free mm/slub.c:3661 [inline] __kmem_cache_free+0x218/0x3b0 mm/slub.c:3674 kfree+0x7a/0xf0 mm/slab_common.c:988 hci_release_dev+0x1508/0x1670 net/bluetooth/hci_core.c:2767 bt_host_release+0x83/0xa0 net/bluetooth/hci_sysfs.c:92 device_release+0x95/0x1c0 kobject_cleanup lib/kobject.c:681 [inline] kobject_release lib/kobject.c:712 [inline] kref_put include/linux/kref.h:65 [inline] kobject_put+0x178/0x260 lib/kobject.c:729 put_device+0x1f/0x30 drivers/base/core.c:3797 hci_dev_put include/net/bluetooth/hci_core.h:1430 [inline] hci_dev_cmd+0x2be/0x9b0 net/bluetooth/hci_core.c:795 hci_sock_ioctl+0x415/0x7f0 net/bluetooth/hci_sock.c:1096 sock_do_ioctl+0x152/0x450 net/socket.c:1204 sock_ioctl+0x3d4/0x700 net/socket.c:1321 vfs_ioctl fs/ioctl.c:51 [inline] __do_sys_ioctl fs/ioctl.c:870 [inline] __se_sys_ioctl+0x114/0x190 fs/ioctl.c:856 __x64_sys_ioctl+0x7b/0x90 fs/ioctl.c:856 x64_sys_call+0x98/0x9a0 arch/x86/include/generated/asm/syscalls_64.h:17 do_syscall_x64 arch/x86/entry/common.c:51 [inline] do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:81 entry_SYSCALL_64_after_hwframe+0x68/0xd2 Last potentially related work creation: kasan_save_stack+0x3b/0x60 mm/kasan/common.c:45 __kasan_record_aux_stack+0xb4/0xc0 mm/kasan/generic.c:486 kasan_record_aux_stack_noalloc+0xb/0x10 mm/kasan/generic.c:496 insert_work+0x56/0x310 kernel/workqueue.c:1361 __queue_work+0x9b6/0xd70 kernel/workqueue.c:1520 queue_work_on+0x105/0x170 kernel/workqueue.c:1548 queue_work include/linux/workqueue.h:512 [inline] hci_cmd_sync_run net/bluetooth/hci_sync.c:144 [inline] __hci_cmd_sync_sk+0xc58/0xfa0 net/bluetooth/hci_sync.c:166 __hci_cmd_sync_status_sk net/bluetooth/hci_sync.c:257 [inline] __hci_cmd_sync_status net/bluetooth/hci_sync.c:281 [inline] hci_cmd_sync_status+0x52/0x150 net/bluetooth/hci_sync.c:292 hci_dev_cmd+0x771/0x9b0 hci_sock_ioctl+0x415/0x7f0 net/bluetooth/hci_sock.c:1096 sock_do_ioctl+0x152/0x450 net/socket.c:1204 sock_ioctl+0x3d4/0x700 net/socket.c:1321 vfs_ioctl fs/ioctl.c:51 [inline] __do_sys_ioctl fs/ioctl.c:870 [inline] __se_sys_ioctl+0x114/0x190 fs/ioctl.c:856 __x64_sys_ioctl+0x7b/0x90 fs/ioctl.c:856 x64_sys_call+0x98/0x9a0 arch/x86/include/generated/asm/syscalls_64.h:17 do_syscall_x64 arch/x86/entry/common.c:51 [inline] do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:81 entry_SYSCALL_64_after_hwframe+0x68/0xd2 Second to last potentially related work creation: kasan_save_stack+0x3b/0x60 mm/kasan/common.c:45 __kasan_record_aux_stack+0xb4/0xc0 mm/kasan/generic.c:486 kasan_record_aux_stack_noalloc+0xb/0x10 mm/kasan/generic.c:496 insert_work+0x56/0x310 kernel/workqueue.c:1361 __queue_work+0x9b6/0xd70 kernel/workqueue.c:1520 queue_work_on+0x105/0x170 kernel/workqueue.c:1548 queue_work include/linux/workqueue.h:512 [inline] hci_cmd_sync_run net/bluetooth/hci_sync.c:144 [inline] __hci_cmd_sync_sk+0xc58/0xfa0 net/bluetooth/hci_sync.c:166 __hci_cmd_sync_status_sk net/bluetooth/hci_sync.c:257 [inline] __hci_cmd_sync_status net/bluetooth/hci_sync.c:281 [inline] hci_cmd_sync_status+0x52/0x150 net/bluetooth/hci_sync.c:292 hci_dev_cmd+0x771/0x9b0 hci_sock_ioctl+0x415/0x7f0 net/bluetooth/hci_sock.c:1096 sock_do_ioctl+0x152/0x450 net/socket.c:1204 sock_ioctl+0x3d4/0x700 net/socket.c:1321 vfs_ioctl fs/ioctl.c:51 [inline] __do_sys_ioctl fs/ioctl.c:870 [inline] __se_sys_ioctl+0x114/0x190 fs/ioctl.c:856 __x64_sys_ioctl+0x7b/0x90 fs/ioctl.c:856 x64_sys_call+0x98/0x9a0 arch/x86/include/generated/asm/syscalls_64.h:17 do_syscall_x64 arch/x86/entry/common.c:51 [inline] do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:81 entry_SYSCALL_64_after_hwframe+0x68/0xd2 The buggy address belongs to the object at ffff888121ed4000 which belongs to the cache kmalloc-8k of size 8192 The buggy address is located 2272 bytes inside of 8192-byte region [ffff888121ed4000, ffff888121ed6000) The buggy address belongs to the physical page: page:ffffea000487b400 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x121ed0 head:ffffea000487b400 order:3 compound_mapcount:0 compound_pincount:0 flags: 0x4000000000010200(slab|head|zone=1) raw: 4000000000010200 0000000000000000 dead000000000122 ffff888100042280 raw: 0000000000000000 0000000000020002 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 608, tgid 606 (syz.2.21), ts 59454529070, free_ts 54024465768 set_page_owner include/linux/page_owner.h:31 [inline] post_alloc_hook+0x1e2/0x1f0 mm/page_alloc.c:2517 prep_new_page mm/page_alloc.c:2524 [inline] get_page_from_freelist+0x2e1c/0x2ef0 mm/page_alloc.c:4290 __alloc_pages+0x3c2/0x7d0 mm/page_alloc.c:5558 allocate_slab mm/slub.c:1939 [inline] new_slab+0xce/0x4c0 mm/slub.c:1992 ___slab_alloc+0x6f9/0xb80 mm/slub.c:3180 __slab_alloc+0x5d/0xa0 mm/slub.c:3279 slab_alloc_node mm/slub.c:3364 [inline] __kmem_cache_alloc_node+0x1af/0x250 mm/slub.c:3437 __do_kmalloc_node mm/slab_common.c:935 [inline] __kmalloc+0xa3/0x1e0 mm/slab_common.c:949 kmalloc include/linux/slab.h:562 [inline] kzalloc include/linux/slab.h:693 [inline] hci_alloc_dev_priv+0x27/0x1c00 net/bluetooth/hci_core.c:2436 hci_alloc_dev include/net/bluetooth/hci_core.h:1470 [inline] hci_uart_register_dev drivers/bluetooth/hci_ldisc.c:636 [inline] hci_uart_set_proto drivers/bluetooth/hci_ldisc.c:712 [inline] hci_uart_tty_ioctl+0x3fb/0xa70 drivers/bluetooth/hci_ldisc.c:765 tty_ioctl+0x903/0xc50 drivers/tty/tty_io.c:2785 vfs_ioctl fs/ioctl.c:51 [inline] __do_sys_ioctl fs/ioctl.c:870 [inline] __se_sys_ioctl+0x114/0x190 fs/ioctl.c:856 __x64_sys_ioctl+0x7b/0x90 fs/ioctl.c:856 x64_sys_call+0x98/0x9a0 arch/x86/include/generated/asm/syscalls_64.h:17 do_syscall_x64 arch/x86/entry/common.c:51 [inline] do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:81 entry_SYSCALL_64_after_hwframe+0x68/0xd2 page last free stack trace: reset_page_owner include/linux/page_owner.h:24 [inline] free_pages_prepare mm/page_alloc.c:1444 [inline] free_pcp_prepare mm/page_alloc.c:1517 [inline] free_unref_page_prepare+0x83d/0x850 mm/page_alloc.c:3369 free_unref_page+0x36/0x3c0 mm/page_alloc.c:3464 free_the_page mm/page_alloc.c:754 [inline] __free_pages+0x61/0xf0 mm/page_alloc.c:5647 __vunmap+0x9f3/0xb60 mm/vmalloc.c:2717 __vfree mm/vmalloc.c:2765 [inline] vfree+0x5c/0x80 mm/vmalloc.c:2796 kcov_put kernel/kcov.c:437 [inline] kcov_close+0x2b/0x50 kernel/kcov.c:533 __fput+0x1e5/0x870 fs/file_table.c:320 ____fput+0x15/0x20 fs/file_table.c:348 task_work_run+0x24d/0x2e0 kernel/task_work.c:203 exit_task_work include/linux/task_work.h:39 [inline] do_exit+0xba5/0x2910 kernel/exit.c:871 do_group_exit+0x21a/0x2d0 kernel/exit.c:1021 get_signal+0x169d/0x1820 kernel/signal.c:2870 arch_do_signal_or_restart+0xb0/0x16f0 arch/x86/kernel/signal.c:871 exit_to_user_mode_loop+0x74/0xa0 kernel/entry/common.c:174 exit_to_user_mode_prepare+0x5a/0xa0 kernel/entry/common.c:210 __syscall_exit_to_user_mode_work kernel/entry/common.c:292 [inline] syscall_exit_to_user_mode+0x26/0x130 kernel/entry/common.c:303 Memory state around the buggy address: ffff888121ed4780: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff888121ed4800: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff888121ed4880: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff888121ed4900: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff888121ed4980: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ================================================================== Bluetooth: hci0: Opcode 0x1003 failed: -110 Bluetooth: hci2: command 0x1003 tx timeout