================================================================== BUG: KASAN: use-after-free in __mutex_waiter_is_first kernel/locking/mutex.c:197 [inline] BUG: KASAN: use-after-free in __mutex_lock_common kernel/locking/mutex.c:681 [inline] BUG: KASAN: use-after-free in __mutex_lock+0x56e/0xaf0 kernel/locking/mutex.c:747 Read of size 8 at addr ffff8880594d8060 by task khidpd_05c25886/5727 CPU: 1 PID: 5727 Comm: khidpd_05c25886 Not tainted 6.1.139-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 04/19/2025 Call Trace: dump_stack_lvl+0x168/0x22e lib/dump_stack.c:106 print_address_description mm/kasan/report.c:316 [inline] print_report+0xa8/0x220 mm/kasan/report.c:427 kasan_report+0x10b/0x140 mm/kasan/report.c:531 __mutex_waiter_is_first kernel/locking/mutex.c:197 [inline] __mutex_lock_common kernel/locking/mutex.c:681 [inline] __mutex_lock+0x56e/0xaf0 kernel/locking/mutex.c:747 l2cap_unregister_user+0x66/0x1a0 net/bluetooth/l2cap_core.c:1893 hidp_session_thread+0x3c4/0x400 net/bluetooth/hidp/core.c:1305 kthread+0x29d/0x330 kernel/kthread.c:376 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:295 Allocated by task 5289: kasan_save_stack mm/kasan/common.c:45 [inline] kasan_set_track+0x4b/0x70 mm/kasan/common.c:52 ____kasan_kmalloc mm/kasan/common.c:374 [inline] __kasan_kmalloc+0x8e/0xa0 mm/kasan/common.c:383 kasan_kmalloc include/linux/kasan.h:211 [inline] __do_kmalloc_node mm/slab_common.c:936 [inline] __kmalloc+0xb0/0x240 mm/slab_common.c:949 kmalloc include/linux/slab.h:568 [inline] kzalloc include/linux/slab.h:699 [inline] hci_alloc_dev_priv+0x23/0x1d20 net/bluetooth/hci_core.c:2436 hci_alloc_dev include/net/bluetooth/hci_core.h:1469 [inline] __vhci_create_device drivers/bluetooth/hci_vhci.c:308 [inline] vhci_create_device+0x13b/0x740 drivers/bluetooth/hci_vhci.c:379 vhci_get_user drivers/bluetooth/hci_vhci.c:436 [inline] vhci_write+0x39a/0x460 drivers/bluetooth/hci_vhci.c:516 call_write_iter include/linux/fs.h:2265 [inline] new_sync_write fs/read_write.c:491 [inline] vfs_write+0x44c/0x960 fs/read_write.c:584 ksys_write+0x143/0x240 fs/read_write.c:637 do_syscall_x64 arch/x86/entry/common.c:51 [inline] do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:81 entry_SYSCALL_64_after_hwframe+0x68/0xd2 Freed by task 5775: kasan_save_stack mm/kasan/common.c:45 [inline] kasan_set_track+0x4b/0x70 mm/kasan/common.c:52 kasan_save_free_info+0x2d/0x50 mm/kasan/generic.c:516 ____kasan_slab_free+0x126/0x1e0 mm/kasan/common.c:236 kasan_slab_free include/linux/kasan.h:177 [inline] slab_free_hook mm/slub.c:1724 [inline] slab_free_freelist_hook+0x131/0x1a0 mm/slub.c:1750 slab_free mm/slub.c:3661 [inline] __kmem_cache_free+0xb6/0x1f0 mm/slub.c:3674 hci_release_dev+0x13c4/0x1530 net/bluetooth/hci_core.c:2766 bt_host_release+0x7e/0x90 net/bluetooth/hci_sysfs.c:85 device_release+0x92/0x1c0 drivers/base/core.c:-1 kobject_cleanup lib/kobject.c:681 [inline] kobject_release lib/kobject.c:712 [inline] kref_put include/linux/kref.h:65 [inline] kobject_put+0x21d/0x460 lib/kobject.c:729 vhci_release+0x87/0xd0 drivers/bluetooth/hci_vhci.c:574 __fput+0x22c/0x920 fs/file_table.c:320 task_work_run+0x1ca/0x250 kernel/task_work.c:203 exit_task_work include/linux/task_work.h:39 [inline] do_exit+0x936/0x2400 kernel/exit.c:871 do_group_exit+0x217/0x2d0 kernel/exit.c:1021 get_signal+0x1272/0x1350 kernel/signal.c:2871 arch_do_signal_or_restart+0xb0/0x1230 arch/x86/kernel/signal.c:871 exit_to_user_mode_loop+0x70/0x110 kernel/entry/common.c:174 exit_to_user_mode_prepare+0xb1/0x140 kernel/entry/common.c:210 __syscall_exit_to_user_mode_work kernel/entry/common.c:292 [inline] syscall_exit_to_user_mode+0x16/0x40 kernel/entry/common.c:303 do_syscall_64+0x58/0xa0 arch/x86/entry/common.c:87 entry_SYSCALL_64_after_hwframe+0x68/0xd2 Last potentially related work creation: kasan_save_stack+0x3a/0x60 mm/kasan/common.c:45 __kasan_record_aux_stack+0xb2/0xc0 mm/kasan/generic.c:486 insert_work+0x54/0x3c0 kernel/workqueue.c:1361 __queue_work+0xba3/0xfb0 kernel/workqueue.c:1520 queue_work_on+0x11d/0x1d0 kernel/workqueue.c:1548 process_one_work+0x898/0x1160 kernel/workqueue.c:2292 worker_thread+0xaa2/0x1250 kernel/workqueue.c:2439 kthread+0x29d/0x330 kernel/kthread.c:376 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:295 Second to last potentially related work creation: kasan_save_stack+0x3a/0x60 mm/kasan/common.c:45 __kasan_record_aux_stack+0xb2/0xc0 mm/kasan/generic.c:486 insert_work+0x54/0x3c0 kernel/workqueue.c:1361 __queue_work+0xba3/0xfb0 kernel/workqueue.c:1520 call_timer_fn+0x1a0/0x670 kernel/time/timer.c:1504 expire_timers kernel/time/timer.c:1544 [inline] __run_timers+0x550/0x7c0 kernel/time/timer.c:1820 run_timer_softirq+0x63/0xf0 kernel/time/timer.c:1833 handle_softirqs+0x2a1/0x920 kernel/softirq.c:578 __do_softirq kernel/softirq.c:612 [inline] invoke_softirq kernel/softirq.c:452 [inline] __irq_exit_rcu+0x12f/0x220 kernel/softirq.c:661 irq_exit_rcu+0x5/0x20 kernel/softirq.c:673 instr_sysvec_apic_timer_interrupt arch/x86/kernel/apic/apic.c:1118 [inline] sysvec_apic_timer_interrupt+0xa0/0xc0 arch/x86/kernel/apic/apic.c:1118 asm_sysvec_apic_timer_interrupt+0x16/0x20 arch/x86/include/asm/idtentry.h:691 The buggy address belongs to the object at ffff8880594d8000 which belongs to the cache kmalloc-8k of size 8192 The buggy address is located 96 bytes inside of 8192-byte region [ffff8880594d8000, ffff8880594da000) The buggy address belongs to the physical page: page:ffffea0001653600 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x594d8 head:ffffea0001653600 order:3 compound_mapcount:0 compound_pincount:0 flags: 0xfff00000010200(slab|head|node=0|zone=1|lastcpupid=0x7ff) raw: 00fff00000010200 0000000000000000 dead000000000001 ffff888017442280 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 5043, tgid 5038 (syz.1.204), ts 115904214122, free_ts 115471699141 set_page_owner include/linux/page_owner.h:31 [inline] post_alloc_hook+0x173/0x1a0 mm/page_alloc.c:2532 prep_new_page mm/page_alloc.c:2539 [inline] get_page_from_freelist+0x1a26/0x1ac0 mm/page_alloc.c:4328 __alloc_pages+0x1df/0x4e0 mm/page_alloc.c:5606 alloc_slab_page+0x5d/0x160 mm/slub.c:1794 allocate_slab mm/slub.c:1939 [inline] new_slab+0x87/0x2c0 mm/slub.c:1992 ___slab_alloc+0xbc6/0x1220 mm/slub.c:3180 __slab_alloc mm/slub.c:3279 [inline] slab_alloc_node mm/slub.c:3364 [inline] __kmem_cache_alloc_node+0x1a0/0x260 mm/slub.c:3437 kmalloc_trace+0x26/0xe0 mm/slab_common.c:1026 kmalloc include/linux/slab.h:563 [inline] audit_log_d_path+0xc0/0x260 kernel/audit.c:2151 audit_log_d_path_exe+0x3e/0x70 kernel/audit.c:2222 audit_log_task+0x20c/0x2d0 kernel/auditsc.c:2948 audit_seccomp+0x81/0x180 kernel/auditsc.c:2995 seccomp_log kernel/seccomp.c:994 [inline] __seccomp_filter+0xa33/0x1ad0 kernel/seccomp.c:1280 syscall_trace_enter+0xa7/0x150 kernel/entry/common.c:72 do_syscall_64+0x24/0xa0 arch/x86/entry/common.c:77 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:1459 [inline] free_pcp_prepare mm/page_alloc.c:1509 [inline] free_unref_page_prepare+0x8b4/0x9a0 mm/page_alloc.c:3384 free_unref_page+0x2e/0x3f0 mm/page_alloc.c:3479 qlink_free mm/kasan/quarantine.c:168 [inline] qlist_free_all+0x76/0xe0 mm/kasan/quarantine.c:187 kasan_quarantine_reduce+0x144/0x160 mm/kasan/quarantine.c:294 __kasan_slab_alloc+0x1e/0x80 mm/kasan/common.c:305 kasan_slab_alloc include/linux/kasan.h:201 [inline] slab_post_alloc_hook+0x4b/0x480 mm/slab.h:737 slab_alloc_node mm/slub.c:3398 [inline] slab_alloc mm/slub.c:3406 [inline] __kmem_cache_alloc_lru mm/slub.c:3413 [inline] kmem_cache_alloc+0x123/0x2f0 mm/slub.c:3422 getname_flags+0xb7/0x500 fs/namei.c:139 getname fs/namei.c:218 [inline] __do_sys_symlink fs/namei.c:4522 [inline] __se_sys_symlink fs/namei.c:4520 [inline] __x64_sys_symlink+0x5b/0x90 fs/namei.c:4520 do_syscall_x64 arch/x86/entry/common.c:51 [inline] do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:81 entry_SYSCALL_64_after_hwframe+0x68/0xd2 Memory state around the buggy address: ffff8880594d7f00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ffff8880594d7f80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc >ffff8880594d8000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff8880594d8080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff8880594d8100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ==================================================================