================================================================== BUG: KASAN: slab-use-after-free in __mutex_waiter_is_first kernel/locking/mutex.c:172 [inline] BUG: KASAN: slab-use-after-free in __mutex_lock_common+0xf0c/0x28f4 kernel/locking/mutex.c:667 Read of size 8 at addr ffff0000ec2e8060 by task khidpd_0b575500/6518 CPU: 1 UID: 0 PID: 6518 Comm: khidpd_0b575500 Not tainted 6.13.0-rc3-syzkaller-g573067a5a685 #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/13/2024 Call trace: show_stack+0x2c/0x3c arch/arm64/kernel/stacktrace.c:466 (C) __dump_stack lib/dump_stack.c:94 [inline] dump_stack_lvl+0xe4/0x150 lib/dump_stack.c:120 print_address_description mm/kasan/report.c:378 [inline] print_report+0x198/0x538 mm/kasan/report.c:489 kasan_report+0xd8/0x138 mm/kasan/report.c:602 __asan_report_load8_noabort+0x20/0x2c mm/kasan/report_generic.c:381 __mutex_waiter_is_first kernel/locking/mutex.c:172 [inline] __mutex_lock_common+0xf0c/0x28f4 kernel/locking/mutex.c:667 __mutex_lock kernel/locking/mutex.c:735 [inline] mutex_lock_nested+0x2c/0x38 kernel/locking/mutex.c:787 l2cap_unregister_user+0x78/0x194 net/bluetooth/l2cap_core.c:1726 hidp_session_thread+0x46c/0x508 net/bluetooth/hidp/core.c:1304 kthread+0x288/0x310 kernel/kthread.c:389 ret_from_fork+0x10/0x20 arch/arm64/kernel/entry.S:862 Allocated by task 6427: kasan_save_stack mm/kasan/common.c:47 [inline] kasan_save_track+0x40/0x78 mm/kasan/common.c:68 kasan_save_alloc_info+0x40/0x50 mm/kasan/generic.c:568 poison_kmalloc_redzone mm/kasan/common.c:377 [inline] __kasan_kmalloc+0xac/0xc4 mm/kasan/common.c:394 kasan_kmalloc include/linux/kasan.h:260 [inline] __do_kmalloc_node mm/slub.c:4298 [inline] __kmalloc_noprof+0x32c/0x54c mm/slub.c:4310 kmalloc_noprof include/linux/slab.h:905 [inline] kzalloc_noprof include/linux/slab.h:1037 [inline] hci_alloc_dev_priv+0x30/0x1ae0 net/bluetooth/hci_core.c:2439 hci_alloc_dev include/net/bluetooth/hci_core.h:1693 [inline] __vhci_create_device drivers/bluetooth/hci_vhci.c:399 [inline] vhci_create_device+0x114/0x68c drivers/bluetooth/hci_vhci.c:470 vhci_get_user drivers/bluetooth/hci_vhci.c:527 [inline] vhci_write+0x324/0x3c8 drivers/bluetooth/hci_vhci.c:607 new_sync_write fs/read_write.c:586 [inline] vfs_write+0x920/0xcf4 fs/read_write.c:679 ksys_write+0x15c/0x26c fs/read_write.c:731 __do_sys_write fs/read_write.c:742 [inline] __se_sys_write fs/read_write.c:739 [inline] __arm64_sys_write+0x7c/0x90 fs/read_write.c:739 __invoke_syscall arch/arm64/kernel/syscall.c:35 [inline] invoke_syscall+0x98/0x2b8 arch/arm64/kernel/syscall.c:49 el0_svc_common+0x130/0x23c arch/arm64/kernel/syscall.c:132 do_el0_svc+0x48/0x58 arch/arm64/kernel/syscall.c:151 el0_svc+0x54/0x168 arch/arm64/kernel/entry-common.c:744 el0t_64_sync_handler+0x84/0x108 arch/arm64/kernel/entry-common.c:762 el0t_64_sync+0x198/0x19c arch/arm64/kernel/entry.S:600 Freed by task 6606: kasan_save_stack mm/kasan/common.c:47 [inline] kasan_save_track+0x40/0x78 mm/kasan/common.c:68 kasan_save_free_info+0x54/0x6c mm/kasan/generic.c:582 poison_slab_object mm/kasan/common.c:247 [inline] __kasan_slab_free+0x64/0x8c mm/kasan/common.c:264 kasan_slab_free include/linux/kasan.h:233 [inline] slab_free_hook mm/slub.c:2353 [inline] slab_free mm/slub.c:4613 [inline] kfree+0x180/0x478 mm/slub.c:4761 hci_release_dev+0x1044/0x11a4 net/bluetooth/hci_core.c:2758 bt_host_release+0x70/0x88 net/bluetooth/hci_sysfs.c:87 device_release+0x8c/0x1ac kobject_cleanup lib/kobject.c:689 [inline] kobject_release lib/kobject.c:720 [inline] kref_put include/linux/kref.h:65 [inline] kobject_put+0x2a8/0x41c lib/kobject.c:737 put_device+0x28/0x40 drivers/base/core.c:3773 hci_free_dev+0x24/0x34 net/bluetooth/hci_core.c:2564 vhci_release+0x84/0xd0 drivers/bluetooth/hci_vhci.c:665 __fput+0x1bc/0x75c fs/file_table.c:450 ____fput+0x20/0x30 fs/file_table.c:478 task_work_run+0x230/0x2e0 kernel/task_work.c:239 exit_task_work include/linux/task_work.h:43 [inline] do_exit+0x4ec/0x1ad0 kernel/exit.c:938 do_group_exit+0x194/0x22c kernel/exit.c:1087 get_signal+0x1418/0x1534 kernel/signal.c:3017 do_signal+0x22c/0x39f4 arch/arm64/kernel/signal.c:1663 do_notify_resume+0x74/0x1f4 arch/arm64/kernel/entry-common.c:148 exit_to_user_mode_prepare arch/arm64/kernel/entry-common.c:169 [inline] exit_to_user_mode arch/arm64/kernel/entry-common.c:178 [inline] el0_svc+0xac/0x168 arch/arm64/kernel/entry-common.c:745 el0t_64_sync_handler+0x84/0x108 arch/arm64/kernel/entry-common.c:762 el0t_64_sync+0x198/0x19c arch/arm64/kernel/entry.S:600 Last potentially related work creation: kasan_save_stack+0x40/0x6c mm/kasan/common.c:47 __kasan_record_aux_stack+0xb8/0xd0 mm/kasan/generic.c:544 kasan_record_aux_stack_noalloc+0x14/0x20 mm/kasan/generic.c:554 insert_work+0x54/0x2d4 kernel/workqueue.c:2183 __queue_work+0xcf4/0x1308 kernel/workqueue.c:2343 queue_work_on+0xe0/0x1a0 kernel/workqueue.c:2390 queue_work include/linux/workqueue.h:662 [inline] hci_cmd_timeout+0x198/0x1cc net/bluetooth/hci_core.c:1463 process_one_work+0x7a8/0x15cc kernel/workqueue.c:3229 process_scheduled_works kernel/workqueue.c:3310 [inline] worker_thread+0x97c/0xeec kernel/workqueue.c:3391 kthread+0x288/0x310 kernel/kthread.c:389 ret_from_fork+0x10/0x20 arch/arm64/kernel/entry.S:862 Second to last potentially related work creation: kasan_save_stack+0x40/0x6c mm/kasan/common.c:47 __kasan_record_aux_stack+0xb8/0xd0 mm/kasan/generic.c:544 kasan_record_aux_stack_noalloc+0x14/0x20 mm/kasan/generic.c:554 insert_work+0x54/0x2d4 kernel/workqueue.c:2183 __queue_work+0xe20/0x1308 kernel/workqueue.c:2339 delayed_work_timer_fn+0x74/0x90 kernel/workqueue.c:2485 call_timer_fn+0x1b4/0x8b8 kernel/time/timer.c:1793 expire_timers kernel/time/timer.c:1839 [inline] __run_timers kernel/time/timer.c:2418 [inline] __run_timer_base+0x59c/0x7b4 kernel/time/timer.c:2430 run_timer_base kernel/time/timer.c:2439 [inline] run_timer_softirq+0xcc/0x194 kernel/time/timer.c:2449 handle_softirqs+0x320/0xd34 kernel/softirq.c:561 __do_softirq+0x14/0x20 kernel/softirq.c:595 The buggy address belongs to the object at ffff0000ec2e8000 which belongs to the cache kmalloc-8k of size 8192 The buggy address is located 96 bytes inside of freed 8192-byte region [ffff0000ec2e8000, ffff0000ec2ea000) The buggy address belongs to the physical page: page: refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x12c2e8 head: order:3 mapcount:0 entire_mapcount:0 nr_pages_mapped:0 pincount:0 flags: 0x5ffc00000000040(head|node=0|zone=2|lastcpupid=0x7ff) page_type: f5(slab) raw: 05ffc00000000040 ffff0000c0002280 dead000000000122 0000000000000000 raw: 0000000000000000 0000000000020002 00000001f5000000 0000000000000000 head: 05ffc00000000040 ffff0000c0002280 dead000000000122 0000000000000000 head: 0000000000000000 0000000000020002 00000001f5000000 0000000000000000 head: 05ffc00000000003 fffffdffc3b0ba01 ffffffffffffffff 0000000000000000 head: 0000000000000008 0000000000000000 00000000ffffffff 0000000000000000 page dumped because: kasan: bad access detected Memory state around the buggy address: ffff0000ec2e7f00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ffff0000ec2e7f80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc >ffff0000ec2e8000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff0000ec2e8080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff0000ec2e8100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ==================================================================