================================================================== BUG: KASAN: slab-use-after-free in __lock_acquire+0x2dfe/0x3ce0 kernel/locking/lockdep.c:5065 Read of size 8 at addr ffff88804e9132f0 by task kworker/2:6/7846 CPU: 2 UID: 0 PID: 7846 Comm: kworker/2:6 Not tainted 6.12.0-rc7-syzkaller #0 Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2~bpo12+1 04/01/2014 Workqueue: events l2cap_chan_timeout Call Trace: __dump_stack lib/dump_stack.c:94 [inline] dump_stack_lvl+0x116/0x1f0 lib/dump_stack.c:120 print_address_description mm/kasan/report.c:377 [inline] print_report+0xc3/0x620 mm/kasan/report.c:488 kasan_report+0xd9/0x110 mm/kasan/report.c:601 __lock_acquire+0x2dfe/0x3ce0 kernel/locking/lockdep.c:5065 lock_acquire.part.0+0x11b/0x380 kernel/locking/lockdep.c:5825 __raw_spin_lock include/linux/spinlock_api_smp.h:133 [inline] _raw_spin_lock+0x2e/0x40 kernel/locking/spinlock.c:154 __mutex_lock_common kernel/locking/mutex.c:622 [inline] __mutex_lock+0x264/0x9c0 kernel/locking/mutex.c:752 l2cap_chan_timeout+0x6d/0x310 net/bluetooth/l2cap_core.c:421 process_one_work+0x9c5/0x1ba0 kernel/workqueue.c:3229 process_scheduled_works kernel/workqueue.c:3310 [inline] worker_thread+0x6c8/0xf00 kernel/workqueue.c:3391 kthread+0x2c1/0x3a0 kernel/kthread.c:389 ret_from_fork+0x45/0x80 arch/x86/kernel/process.c:147 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:244 Allocated by task 9690: kasan_save_stack+0x33/0x60 mm/kasan/common.c:47 kasan_save_track+0x14/0x30 mm/kasan/common.c:68 poison_kmalloc_redzone mm/kasan/common.c:377 [inline] __kasan_kmalloc+0xaa/0xb0 mm/kasan/common.c:394 kmalloc_noprof include/linux/slab.h:878 [inline] kzalloc_noprof include/linux/slab.h:1014 [inline] l2cap_conn_add.part.0+0x60/0xa60 net/bluetooth/l2cap_core.c:6860 l2cap_conn_add include/net/bluetooth/hci_core.h:1546 [inline] l2cap_chan_connect+0x15fa/0x2040 net/bluetooth/l2cap_core.c:7051 l2cap_sock_connect+0x3b8/0x740 net/bluetooth/l2cap_sock.c:256 kernel_connect+0x105/0x180 net/socket.c:3652 rfcomm_session_create net/bluetooth/rfcomm/core.c:811 [inline] __rfcomm_dlc_open net/bluetooth/rfcomm/core.c:388 [inline] rfcomm_dlc_open+0x823/0xaa0 net/bluetooth/rfcomm/core.c:431 rfcomm_sock_connect+0x418/0x630 net/bluetooth/rfcomm/sock.c:409 __sys_connect_file+0x14d/0x190 net/socket.c:2071 __sys_connect+0x147/0x180 net/socket.c:2088 __do_sys_connect net/socket.c:2098 [inline] __se_sys_connect net/socket.c:2095 [inline] __x64_sys_connect+0x72/0xb0 net/socket.c:2095 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xcd/0x250 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x77/0x7f Freed by task 10138: kasan_save_stack+0x33/0x60 mm/kasan/common.c:47 kasan_save_track+0x14/0x30 mm/kasan/common.c:68 kasan_save_free_info+0x3b/0x60 mm/kasan/generic.c:579 poison_slab_object mm/kasan/common.c:247 [inline] __kasan_slab_free+0x51/0x70 mm/kasan/common.c:264 kasan_slab_free include/linux/kasan.h:230 [inline] slab_free_hook mm/slub.c:2342 [inline] slab_free mm/slub.c:4579 [inline] kfree+0x14f/0x4b0 mm/slub.c:4727 l2cap_conn_free net/bluetooth/l2cap_core.c:1810 [inline] kref_put include/linux/kref.h:65 [inline] l2cap_conn_put net/bluetooth/l2cap_core.c:1822 [inline] l2cap_conn_del+0x59d/0x730 net/bluetooth/l2cap_core.c:1802 l2cap_disconn_cfm net/bluetooth/l2cap_core.c:7299 [inline] l2cap_disconn_cfm+0x96/0xd0 net/bluetooth/l2cap_core.c:7292 hci_disconn_cfm include/net/bluetooth/hci_core.h:1975 [inline] hci_conn_hash_flush+0x114/0x260 net/bluetooth/hci_conn.c:2592 hci_dev_close_sync+0x603/0x11b0 net/bluetooth/hci_sync.c:5205 hci_dev_do_close+0x2e/0x90 net/bluetooth/hci_core.c:483 hci_unregister_dev+0x213/0x620 net/bluetooth/hci_core.c:2698 vhci_release+0x79/0xf0 drivers/bluetooth/hci_vhci.c:664 __fput+0x3f6/0xb60 fs/file_table.c:431 task_work_run+0x14e/0x250 kernel/task_work.c:239 exit_task_work include/linux/task_work.h:43 [inline] do_exit+0xadd/0x2d70 kernel/exit.c:939 do_group_exit+0xd3/0x2a0 kernel/exit.c:1088 get_signal+0x25fb/0x2770 kernel/signal.c:2918 arch_do_signal_or_restart+0x90/0x7e0 arch/x86/kernel/signal.c:337 exit_to_user_mode_loop kernel/entry/common.c:111 [inline] exit_to_user_mode_prepare include/linux/entry-common.h:328 [inline] __syscall_exit_to_user_mode_work kernel/entry/common.c:207 [inline] syscall_exit_to_user_mode+0x150/0x2a0 kernel/entry/common.c:218 do_syscall_64+0xda/0x250 arch/x86/entry/common.c:89 entry_SYSCALL_64_after_hwframe+0x77/0x7f The buggy address belongs to the object at ffff88804e913000 which belongs to the cache kmalloc-1k of size 1024 The buggy address is located 752 bytes inside of freed 1024-byte region [ffff88804e913000, ffff88804e913400) The buggy address belongs to the physical page: page: refcount:1 mapcount:0 mapping:0000000000000000 index:0xffff88804e912000 pfn:0x4e910 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 ffff88801b042dc0 ffffea000136e010 ffffea000193e810 raw: ffff88804e912000 000000000010000e 00000001f5000000 0000000000000000 head: 00fff00000000240 ffff88801b042dc0 ffffea000136e010 ffffea000193e810 head: ffff88804e912000 000000000010000e 00000001f5000000 0000000000000000 head: 00fff00000000003 ffffea00013a4401 ffffffffffffffff 0000000000000000 head: 0000000000000008 0000000000000000 00000000ffffffff 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 0xd2820(GFP_ATOMIC|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC), pid 8832, tgid 8831 (syz.4.672), ts 93235398444, free_ts 92984384146 set_page_owner include/linux/page_owner.h:32 [inline] post_alloc_hook+0x2d1/0x350 mm/page_alloc.c:1541 prep_new_page mm/page_alloc.c:1549 [inline] get_page_from_freelist+0xfce/0x2f80 mm/page_alloc.c:3459 __alloc_pages_noprof+0x223/0x25a0 mm/page_alloc.c:4735 alloc_pages_mpol_noprof+0x2c9/0x610 mm/mempolicy.c:2265 alloc_slab_page mm/slub.c:2412 [inline] allocate_slab mm/slub.c:2578 [inline] new_slab+0x2c9/0x410 mm/slub.c:2631 ___slab_alloc+0xdac/0x1880 mm/slub.c:3818 __slab_alloc.constprop.0+0x56/0xb0 mm/slub.c:3908 __slab_alloc_node mm/slub.c:3961 [inline] slab_alloc_node mm/slub.c:4122 [inline] __do_kmalloc_node mm/slub.c:4263 [inline] __kmalloc_node_track_caller_noprof+0x355/0x430 mm/slub.c:4283 kmalloc_reserve+0xef/0x2c0 net/core/skbuff.c:609 __alloc_skb+0x164/0x380 net/core/skbuff.c:678 alloc_skb include/linux/skbuff.h:1322 [inline] xfrm_alloc_compat+0xb9c/0x1290 net/xfrm/xfrm_compat.c:340 xfrm_nlmsg_multicast net/xfrm/xfrm_user.c:1455 [inline] xfrm_send_acquire+0x675/0xbc0 net/xfrm/xfrm_user.c:3649 km_query+0xb1/0x260 net/xfrm/xfrm_state.c:2491 xfrm_state_find+0x2512/0x68c0 net/xfrm/xfrm_state.c:1350 xfrm_tmpl_resolve_one net/xfrm/xfrm_policy.c:2507 [inline] xfrm_tmpl_resolve net/xfrm/xfrm_policy.c:2558 [inline] xfrm_resolve_and_create_bundle+0x4bc/0x3650 net/xfrm/xfrm_policy.c:2852 xfrm_lookup_with_ifid+0x259/0x1df0 net/xfrm/xfrm_policy.c:3186 page last free pid 8823 tgid 8823 stack trace: reset_page_owner include/linux/page_owner.h:25 [inline] free_pages_prepare mm/page_alloc.c:1112 [inline] free_unref_page+0x5f4/0xdc0 mm/page_alloc.c:2642 __put_partials+0x14c/0x170 mm/slub.c:3145 qlink_free mm/kasan/quarantine.c:163 [inline] qlist_free_all+0x4e/0x120 mm/kasan/quarantine.c:179 kasan_quarantine_reduce+0x192/0x1e0 mm/kasan/quarantine.c:286 __kasan_slab_alloc+0x69/0x90 mm/kasan/common.c:329 kasan_slab_alloc include/linux/kasan.h:247 [inline] slab_post_alloc_hook mm/slub.c:4085 [inline] slab_alloc_node mm/slub.c:4134 [inline] kmem_cache_alloc_noprof+0x121/0x2f0 mm/slub.c:4141 vma_lock_alloc kernel/fork.c:447 [inline] vm_area_alloc+0x134/0x230 kernel/fork.c:478 __mmap_region+0xee0/0x21c0 mm/mmap.c:1435 mmap_region+0x127/0x320 mm/mmap.c:1603 do_mmap+0xc00/0xfc0 mm/mmap.c:496 vm_mmap_pgoff+0x1ba/0x360 mm/util.c:588 ksys_mmap_pgoff+0x7d/0x5c0 mm/mmap.c:542 __do_sys_mmap arch/x86/kernel/sys_x86_64.c:86 [inline] __se_sys_mmap arch/x86/kernel/sys_x86_64.c:79 [inline] __x64_sys_mmap+0x125/0x190 arch/x86/kernel/sys_x86_64.c:79 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xcd/0x250 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x77/0x7f Memory state around the buggy address: ffff88804e913180: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff88804e913200: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff88804e913280: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff88804e913300: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff88804e913380: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ==================================================================