================================================================== BUG: KASAN: slab-use-after-free in __mutex_lock_common kernel/locking/mutex.c:714 [inline] BUG: KASAN: slab-use-after-free in __mutex_lock+0x1887/0x1b10 kernel/locking/mutex.c:806 Read of size 8 at addr ffff8880661c52e8 by task khidpd_10cf0005/21923 CPU: 2 UID: 0 PID: 21923 Comm: khidpd_10cf0005 Tainted: G L syzkaller #0 PREEMPT(full) Tainted: [L]=SOFTLOCKUP Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014 Call Trace: __dump_stack lib/dump_stack.c:94 [inline] dump_stack_lvl+0x100/0x190 lib/dump_stack.c:120 print_address_description mm/kasan/report.c:378 [inline] print_report+0x13d/0x4b0 mm/kasan/report.c:482 kasan_report+0xdf/0x1d0 mm/kasan/report.c:595 __mutex_lock_common kernel/locking/mutex.c:714 [inline] __mutex_lock+0x1887/0x1b10 kernel/locking/mutex.c:806 l2cap_unregister_user+0x2a/0x1e0 net/bluetooth/l2cap_core.c:1740 hidp_session_thread+0x461/0x680 net/bluetooth/hidp/core.c:1315 kthread+0x370/0x450 kernel/kthread.c:436 ret_from_fork+0x72b/0xd50 arch/x86/kernel/process.c:158 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:245 Allocated by task 5937: kasan_save_stack+0x30/0x50 mm/kasan/common.c:57 kasan_save_track+0x14/0x30 mm/kasan/common.c:78 poison_kmalloc_redzone mm/kasan/common.c:398 [inline] __kasan_kmalloc+0xaa/0xb0 mm/kasan/common.c:415 kmalloc_noprof include/linux/slab.h:950 [inline] kzalloc_noprof include/linux/slab.h:1188 [inline] l2cap_conn_add.part.0+0x60/0xb00 net/bluetooth/l2cap_core.c:7009 l2cap_conn_add net/bluetooth/l2cap_core.c:69 [inline] l2cap_connect_cfm+0x43e/0xf80 net/bluetooth/l2cap_core.c:7386 hci_connect_cfm include/net/bluetooth/hci_core.h:2139 [inline] hci_remote_features_evt+0x4f4/0x9b0 net/bluetooth/hci_event.c:3760 hci_event_func net/bluetooth/hci_event.c:7773 [inline] hci_event_packet+0x8e9/0xcd0 net/bluetooth/hci_event.c:7824 hci_rx_work+0x451/0xfc0 net/bluetooth/hci_core.c:4077 process_one_work+0xa0e/0x1980 kernel/workqueue.c:3302 process_scheduled_works kernel/workqueue.c:3385 [inline] worker_thread+0x5ef/0xe50 kernel/workqueue.c:3466 kthread+0x370/0x450 kernel/kthread.c:436 ret_from_fork+0x72b/0xd50 arch/x86/kernel/process.c:158 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:245 Freed by task 20257: kasan_save_stack+0x30/0x50 mm/kasan/common.c:57 kasan_save_track+0x14/0x30 mm/kasan/common.c:78 kasan_save_free_info+0x3b/0x70 mm/kasan/generic.c:584 poison_slab_object mm/kasan/common.c:253 [inline] __kasan_slab_free+0x5f/0x80 mm/kasan/common.c:285 kasan_slab_free include/linux/kasan.h:235 [inline] slab_free_hook mm/slub.c:2689 [inline] slab_free mm/slub.c:6246 [inline] kfree+0x223/0x6c0 mm/slub.c:6561 l2cap_conn_free net/bluetooth/l2cap_core.c:1823 [inline] kref_put include/linux/kref.h:65 [inline] l2cap_conn_put net/bluetooth/l2cap_core.c:1835 [inline] l2cap_conn_del+0x57f/0x710 net/bluetooth/l2cap_core.c:1815 l2cap_disconn_cfm net/bluetooth/l2cap_core.c:7448 [inline] l2cap_disconn_cfm+0x9f/0x100 net/bluetooth/l2cap_core.c:7441 hci_disconn_cfm include/net/bluetooth/hci_core.h:2154 [inline] hci_conn_hash_flush+0x10e/0x280 net/bluetooth/hci_conn.c:2650 hci_dev_close_sync+0x5a7/0x1240 net/bluetooth/hci_sync.c:5368 hci_dev_do_close+0x2e/0xb0 net/bluetooth/hci_core.c:502 hci_unregister_dev+0x227/0x670 net/bluetooth/hci_core.c:2716 vhci_release+0x17d/0x230 drivers/bluetooth/hci_vhci.c:690 __fput+0x3ff/0xb50 fs/file_table.c:510 task_work_run+0x150/0x240 kernel/task_work.c:233 exit_task_work include/linux/task_work.h:40 [inline] do_exit+0x8d2/0x2a60 kernel/exit.c:977 do_group_exit+0xd5/0x2a0 kernel/exit.c:1119 __do_sys_exit_group kernel/exit.c:1130 [inline] __se_sys_exit_group kernel/exit.c:1128 [inline] __x64_sys_exit_group+0x3e/0x50 kernel/exit.c:1128 x64_sys_call+0x102c/0x1530 arch/x86/include/generated/asm/syscalls_64.h:232 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0x10b/0xf80 arch/x86/entry/syscall_64.c:94 entry_SYSCALL_64_after_hwframe+0x77/0x7f Last potentially related work creation: kasan_save_stack+0x30/0x50 mm/kasan/common.c:57 kasan_record_aux_stack+0xa7/0xc0 mm/kasan/generic.c:556 insert_work+0x36/0x230 kernel/workqueue.c:2226 __queue_work+0x9a2/0x1130 kernel/workqueue.c:2381 call_timer_fn+0x19a/0x640 kernel/time/timer.c:1748 expire_timers kernel/time/timer.c:1794 [inline] __run_timers+0x583/0xaf0 kernel/time/timer.c:2374 __run_timer_base kernel/time/timer.c:2386 [inline] __run_timer_base kernel/time/timer.c:2378 [inline] run_timer_base+0x114/0x190 kernel/time/timer.c:2395 run_timer_softirq+0x1a/0x50 kernel/time/timer.c:2405 handle_softirqs+0x1ea/0xa00 kernel/softirq.c:622 __do_softirq kernel/softirq.c:656 [inline] invoke_softirq kernel/softirq.c:496 [inline] __irq_exit_rcu+0x162/0x210 kernel/softirq.c:735 irq_exit_rcu+0x9/0x30 kernel/softirq.c:752 instr_sysvec_apic_timer_interrupt arch/x86/kernel/apic/apic.c:1061 [inline] sysvec_apic_timer_interrupt+0xa3/0xc0 arch/x86/kernel/apic/apic.c:1061 asm_sysvec_apic_timer_interrupt+0x1a/0x20 arch/x86/include/asm/idtentry.h:697 Second to last potentially related work creation: kasan_save_stack+0x30/0x50 mm/kasan/common.c:57 kasan_record_aux_stack+0xa7/0xc0 mm/kasan/generic.c:556 insert_work+0x36/0x230 kernel/workqueue.c:2226 __queue_work+0x3fd/0x1130 kernel/workqueue.c:2385 queue_work_on+0x180/0x1e0 kernel/workqueue.c:2432 queue_work include/linux/workqueue.h:696 [inline] l2cap_conn_ready net/bluetooth/l2cap_core.c:1660 [inline] l2cap_connect_cfm+0x99e/0xf80 net/bluetooth/l2cap_core.c:7427 hci_connect_cfm include/net/bluetooth/hci_core.h:2139 [inline] hci_remote_features_evt+0x4f4/0x9b0 net/bluetooth/hci_event.c:3760 hci_event_func net/bluetooth/hci_event.c:7773 [inline] hci_event_packet+0x8e9/0xcd0 net/bluetooth/hci_event.c:7824 hci_rx_work+0x451/0xfc0 net/bluetooth/hci_core.c:4077 process_one_work+0xa0e/0x1980 kernel/workqueue.c:3302 process_scheduled_works kernel/workqueue.c:3385 [inline] worker_thread+0x5ef/0xe50 kernel/workqueue.c:3466 kthread+0x370/0x450 kernel/kthread.c:436 ret_from_fork+0x72b/0xd50 arch/x86/kernel/process.c:158 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:245 The buggy address belongs to the object at ffff8880661c5000 which belongs to the cache kmalloc-1k of size 1024 The buggy address is located 744 bytes inside of freed 1024-byte region [ffff8880661c5000, ffff8880661c5400) The buggy address belongs to the physical page: page: refcount:0 mapcount:0 mapping:0000000000000000 index:0xffff8880661c6000 pfn:0x661c0 head: order:3 mapcount:0 entire_mapcount:0 nr_pages_mapped:0 pincount:0 flags: 0xfff00000000240(workingset|head|node=0|zone=1|lastcpupid=0x7ff) page_type: f5(slab) raw: 00fff00000000240 ffff88801b842dc0 ffffea0000ea4410 ffffea000166ac10 raw: ffff8880661c6000 0000000800100006 00000000f5000000 0000000000000000 head: 00fff00000000240 ffff88801b842dc0 ffffea0000ea4410 ffffea000166ac10 head: ffff8880661c6000 0000000800100006 00000000f5000000 0000000000000000 head: 00fff00000000003 fffffffffffffe01 00000000ffffffff 00000000ffffffff head: ffffffffffffffff 0000000000000000 00000000ffffffff 0000000000000008 page dumped because: kasan: bad access detected page_owner tracks the page as allocated page last allocated via order 3, migratetype Unmovable, gfp_mask 0xd2820(GFP_ATOMIC|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC), pid 11519, tgid 11519 (kworker/u32:18), ts 391519935585, free_ts 391441163454 set_page_owner include/linux/page_owner.h:32 [inline] post_alloc_hook+0x153/0x170 mm/page_alloc.c:1860 prep_new_page mm/page_alloc.c:1868 [inline] get_page_from_freelist+0x11a6/0x33b0 mm/page_alloc.c:3948 __alloc_frozen_pages_noprof+0x27c/0x2bc0 mm/page_alloc.c:5228 alloc_slab_page mm/slub.c:3278 [inline] allocate_slab mm/slub.c:3467 [inline] new_slab+0xa6/0x6c0 mm/slub.c:3525 refill_objects+0x277/0x420 mm/slub.c:7251 refill_sheaf mm/slub.c:2816 [inline] __pcs_replace_empty_main+0x375/0x650 mm/slub.c:4651 alloc_from_pcs mm/slub.c:4749 [inline] slab_alloc_node mm/slub.c:4883 [inline] __do_kmalloc_node mm/slub.c:5294 [inline] __kmalloc_noprof+0x688/0x850 mm/slub.c:5307 kmalloc_noprof include/linux/slab.h:954 [inline] kzalloc_noprof include/linux/slab.h:1188 [inline] neigh_alloc net/core/neighbour.c:521 [inline] ___neigh_create+0x1545/0x2950 net/core/neighbour.c:655 ip6_finish_output2+0xffa/0x1ce0 net/ipv6/ip6_output.c:128 __ip6_finish_output+0x357/0xdf0 net/ipv6/ip6_output.c:208 ip6_finish_output net/ipv6/ip6_output.c:219 [inline] NF_HOOK_COND include/linux/netfilter.h:307 [inline] ip6_output+0x2aa/0xa60 net/ipv6/ip6_output.c:246 dst_output include/net/dst.h:470 [inline] NF_HOOK include/linux/netfilter.h:318 [inline] ndisc_send_skb+0xa85/0x1bf0 net/ipv6/ndisc.c:512 ndisc_send_rs+0x129/0x680 net/ipv6/ndisc.c:723 addrconf_dad_completed+0x47f/0xff0 net/ipv6/addrconf.c:4372 addrconf_dad_work+0x83c/0x1360 net/ipv6/addrconf.c:4280 process_one_work+0xa0e/0x1980 kernel/workqueue.c:3302 page last free pid 20250 tgid 20242 stack trace: reset_page_owner include/linux/page_owner.h:25 [inline] __free_pages_prepare mm/page_alloc.c:1404 [inline] __free_frozen_pages+0x747/0x1040 mm/page_alloc.c:2945 __folio_put+0x3b4/0x540 mm/swap.c:112 folio_put include/linux/mm.h:2085 [inline] put_page include/linux/mm.h:2154 [inline] do_exit+0x1f59/0x2a60 kernel/exit.c:1008 do_group_exit+0xd5/0x2a0 kernel/exit.c:1119 get_signal+0x1ec7/0x21e0 kernel/signal.c:3039 arch_do_signal_or_restart+0x91/0x7a0 arch/x86/kernel/signal.c:337 __exit_to_user_mode_loop kernel/entry/common.c:64 [inline] exit_to_user_mode_loop+0x86/0x4a0 kernel/entry/common.c:98 __exit_to_user_mode_prepare include/linux/irq-entry-common.h:207 [inline] syscall_exit_to_user_mode_prepare include/linux/irq-entry-common.h:238 [inline] syscall_exit_to_user_mode include/linux/entry-common.h:328 [inline] do_syscall_64+0x706/0xf80 arch/x86/entry/syscall_64.c:100 entry_SYSCALL_64_after_hwframe+0x77/0x7f Memory state around the buggy address: ffff8880661c5180: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff8880661c5200: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff8880661c5280: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff8880661c5300: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff8880661c5380: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ==================================================================