BUG: sleeping function called from invalid context at net/core/sock.c:3545 in_atomic(): 1, irqs_disabled(): 0, non_block: 0, pid: 54, name: kworker/u9:0 preempt_count: 1, expected: 0 RCU nest depth: 0, expected: 0 6 locks held by kworker/u9:0/54: #0: ffff88802e8be148 ((wq_completion)hci5#2){+.+.}-{0:0}, at: process_one_work kernel/workqueue.c:3206 [inline] #0: ffff88802e8be148 ((wq_completion)hci5#2){+.+.}-{0:0}, at: process_scheduled_works+0x90a/0x1830 kernel/workqueue.c:3312 #1: ffffc90000be7d00 ((work_completion)(&hdev->rx_work)){+.+.}-{0:0}, at: process_one_work kernel/workqueue.c:3207 [inline] #1: ffffc90000be7d00 ((work_completion)(&hdev->rx_work)){+.+.}-{0:0}, at: process_scheduled_works+0x945/0x1830 kernel/workqueue.c:3312 #2: ffff8880696a0078 (&hdev->lock){+.+.}-{3:3}, at: hci_sync_conn_complete_evt+0xb1/0xaa0 net/bluetooth/hci_event.c:4925 #3: ffffffff8f776468 (hci_cb_list_lock){+.+.}-{3:3}, at: hci_connect_cfm include/net/bluetooth/hci_core.h:1962 [inline] #3: ffffffff8f776468 (hci_cb_list_lock){+.+.}-{3:3}, at: hci_sync_conn_complete_evt+0x532/0xaa0 net/bluetooth/hci_event.c:5008 #4: ffff88805f88e820 (&conn->lock#2){+.+.}-{2:2}, at: spin_lock include/linux/spinlock.h:351 [inline] #4: ffff88805f88e820 (&conn->lock#2){+.+.}-{2:2}, at: sco_conn_ready net/bluetooth/sco.c:1277 [inline] #4: ffff88805f88e820 (&conn->lock#2){+.+.}-{2:2}, at: sco_connect_cfm+0x28a/0xb40 net/bluetooth/sco.c:1362 #5: ffff88802a3bd258 (sk_lock-AF_BLUETOOTH-BTPROTO_SCO){+.+.}-{0:0}, at: lock_sock include/net/sock.h:1607 [inline] #5: ffff88802a3bd258 (sk_lock-AF_BLUETOOTH-BTPROTO_SCO){+.+.}-{0:0}, at: sco_conn_ready net/bluetooth/sco.c:1290 [inline] #5: ffff88802a3bd258 (sk_lock-AF_BLUETOOTH-BTPROTO_SCO){+.+.}-{0:0}, at: sco_connect_cfm+0x461/0xb40 net/bluetooth/sco.c:1362 Preemption disabled at: [<0000000000000000>] 0x0 CPU: 0 UID: 0 PID: 54 Comm: kworker/u9:0 Not tainted 6.10.0-next-20240719-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 06/27/2024 Workqueue: hci5 hci_rx_work Call Trace: __dump_stack lib/dump_stack.c:94 [inline] dump_stack_lvl+0x241/0x360 lib/dump_stack.c:120 __might_resched+0x5d4/0x780 kernel/sched/core.c:8526 lock_sock_nested+0x5d/0x100 net/core/sock.c:3545 lock_sock include/net/sock.h:1607 [inline] sco_conn_ready net/bluetooth/sco.c:1290 [inline] sco_connect_cfm+0x461/0xb40 net/bluetooth/sco.c:1362 hci_connect_cfm include/net/bluetooth/hci_core.h:1965 [inline] hci_sync_conn_complete_evt+0x5ab/0xaa0 net/bluetooth/hci_event.c:5008 hci_event_func net/bluetooth/hci_event.c:7445 [inline] hci_event_packet+0xac2/0x1540 net/bluetooth/hci_event.c:7497 hci_rx_work+0x3e8/0xca0 net/bluetooth/hci_core.c:4029 process_one_work kernel/workqueue.c:3231 [inline] process_scheduled_works+0xa2c/0x1830 kernel/workqueue.c:3312 worker_thread+0x86d/0xd40 kernel/workqueue.c:3390 kthread+0x2f0/0x390 kernel/kthread.c:389 ret_from_fork+0x4b/0x80 arch/x86/kernel/process.c:144 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:244 ================================================================== BUG: KASAN: slab-use-after-free in __lock_acquire+0x77/0x2050 kernel/locking/lockdep.c:5062 Read of size 8 at addr ffff88802a3bd1d8 by task kworker/u9:0/54 CPU: 0 UID: 0 PID: 54 Comm: kworker/u9:0 Tainted: G W 6.10.0-next-20240719-syzkaller #0 Tainted: [W]=WARN Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 06/27/2024 Workqueue: hci5 hci_rx_work Call Trace: __dump_stack lib/dump_stack.c:94 [inline] dump_stack_lvl+0x241/0x360 lib/dump_stack.c:120 print_address_description mm/kasan/report.c:377 [inline] print_report+0x169/0x550 mm/kasan/report.c:488 kasan_report+0x143/0x180 mm/kasan/report.c:601 __lock_acquire+0x77/0x2050 kernel/locking/lockdep.c:5062 lock_acquire+0x1ed/0x550 kernel/locking/lockdep.c:5822 __raw_spin_lock_bh include/linux/spinlock_api_smp.h:126 [inline] _raw_spin_lock_bh+0x35/0x50 kernel/locking/spinlock.c:178 spin_lock_bh include/linux/spinlock.h:356 [inline] lock_sock_nested+0x6a/0x100 net/core/sock.c:3546 lock_sock include/net/sock.h:1607 [inline] sco_conn_ready net/bluetooth/sco.c:1290 [inline] sco_connect_cfm+0x461/0xb40 net/bluetooth/sco.c:1362 hci_connect_cfm include/net/bluetooth/hci_core.h:1965 [inline] hci_sync_conn_complete_evt+0x5ab/0xaa0 net/bluetooth/hci_event.c:5008 hci_event_func net/bluetooth/hci_event.c:7445 [inline] hci_event_packet+0xac2/0x1540 net/bluetooth/hci_event.c:7497 hci_rx_work+0x3e8/0xca0 net/bluetooth/hci_core.c:4029 process_one_work kernel/workqueue.c:3231 [inline] process_scheduled_works+0xa2c/0x1830 kernel/workqueue.c:3312 worker_thread+0x86d/0xd40 kernel/workqueue.c:3390 kthread+0x2f0/0x390 kernel/kthread.c:389 ret_from_fork+0x4b/0x80 arch/x86/kernel/process.c:144 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:244 Allocated by task 8977: kasan_save_stack mm/kasan/common.c:47 [inline] kasan_save_track+0x3f/0x80 mm/kasan/common.c:68 poison_kmalloc_redzone mm/kasan/common.c:370 [inline] __kasan_kmalloc+0x98/0xb0 mm/kasan/common.c:387 kasan_kmalloc include/linux/kasan.h:211 [inline] __do_kmalloc_node mm/slub.c:4158 [inline] __kmalloc_noprof+0x1fc/0x400 mm/slub.c:4170 kmalloc_noprof include/linux/slab.h:685 [inline] sk_prot_alloc+0xe0/0x210 net/core/sock.c:2096 sk_alloc+0x38/0x370 net/core/sock.c:2149 bt_sock_alloc+0x3c/0x340 net/bluetooth/af_bluetooth.c:148 sco_sock_alloc net/bluetooth/sco.c:500 [inline] sco_sock_create+0xbb/0x390 net/bluetooth/sco.c:531 bt_sock_create+0x161/0x230 net/bluetooth/af_bluetooth.c:132 __sock_create+0x490/0x920 net/socket.c:1571 sock_create net/socket.c:1622 [inline] __sys_socket_create net/socket.c:1659 [inline] __sys_socket+0x150/0x3c0 net/socket.c:1706 __do_sys_socket net/socket.c:1720 [inline] __se_sys_socket net/socket.c:1718 [inline] __x64_sys_socket+0x7a/0x90 net/socket.c:1718 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xf3/0x230 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x77/0x7f Freed by task 8936: kasan_save_stack mm/kasan/common.c:47 [inline] kasan_save_track+0x3f/0x80 mm/kasan/common.c:68 kasan_save_free_info+0x40/0x50 mm/kasan/generic.c:579 poison_slab_object+0xe0/0x150 mm/kasan/common.c:240 __kasan_slab_free+0x37/0x60 mm/kasan/common.c:256 kasan_slab_free include/linux/kasan.h:184 [inline] slab_free_hook mm/slub.c:2252 [inline] slab_free mm/slub.c:4473 [inline] kfree+0x149/0x360 mm/slub.c:4594 sk_prot_free net/core/sock.c:2132 [inline] __sk_destruct+0x479/0x5f0 net/core/sock.c:2224 sco_sock_release+0x25e/0x320 net/bluetooth/sco.c:1259 __sock_release net/socket.c:659 [inline] sock_close+0xbc/0x240 net/socket.c:1421 __fput+0x24a/0x8a0 fs/file_table.c:422 task_work_run+0x24f/0x310 kernel/task_work.c:222 resume_user_mode_work include/linux/resume_user_mode.h:50 [inline] exit_to_user_mode_loop kernel/entry/common.c:114 [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+0x168/0x370 kernel/entry/common.c:218 do_syscall_64+0x100/0x230 arch/x86/entry/common.c:89 entry_SYSCALL_64_after_hwframe+0x77/0x7f The buggy address belongs to the object at ffff88802a3bd000 which belongs to the cache kmalloc-2k of size 2048 The buggy address is located 472 bytes inside of freed 2048-byte region [ffff88802a3bd000, ffff88802a3bd800) The buggy address belongs to the physical page: page: refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x2a3b8 head: order:3 mapcount:0 entire_mapcount:0 nr_pages_mapped:0 pincount:0 flags: 0xfff00000000040(head|node=0|zone=1|lastcpupid=0x7ff) page_type: 0xfdffffff(slab) raw: 00fff00000000040 ffff888015042000 ffffea0000937e00 dead000000000002 raw: 0000000000000000 0000000000080008 00000001fdffffff 0000000000000000 head: 00fff00000000040 ffff888015042000 ffffea0000937e00 dead000000000002 head: 0000000000000000 0000000000080008 00000001fdffffff 0000000000000000 head: 00fff00000000003 ffffea0000a8ee01 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 0x1d20c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC|__GFP_HARDWALL), pid 1792, tgid 1792 (kworker/1:2), ts 151227636607, free_ts 151147484315 set_page_owner include/linux/page_owner.h:32 [inline] post_alloc_hook+0x1f3/0x230 mm/page_alloc.c:1492 prep_new_page mm/page_alloc.c:1500 [inline] get_page_from_freelist+0x2ccb/0x2d80 mm/page_alloc.c:3473 __alloc_pages_noprof+0x256/0x6c0 mm/page_alloc.c:4731 __alloc_pages_node_noprof include/linux/gfp.h:269 [inline] alloc_pages_node_noprof include/linux/gfp.h:296 [inline] alloc_slab_page+0x5f/0x120 mm/slub.c:2321 allocate_slab+0x5a/0x2f0 mm/slub.c:2484 new_slab mm/slub.c:2537 [inline] ___slab_alloc+0xcd1/0x14b0 mm/slub.c:3723 __slab_alloc+0x58/0xa0 mm/slub.c:3813 __slab_alloc_node mm/slub.c:3866 [inline] slab_alloc_node mm/slub.c:4025 [inline] __kmalloc_cache_noprof+0x1d5/0x2c0 mm/slub.c:4184 kmalloc_noprof include/linux/slab.h:681 [inline] kzalloc_noprof include/linux/slab.h:807 [inline] keypair_create drivers/net/wireguard/noise.c:100 [inline] wg_noise_handshake_begin_session+0xc4/0xb80 drivers/net/wireguard/noise.c:827 wg_packet_send_handshake_response+0x120/0x2e0 drivers/net/wireguard/send.c:96 wg_receive_handshake_packet drivers/net/wireguard/receive.c:154 [inline] wg_packet_handshake_receive_worker+0x5e6/0xf50 drivers/net/wireguard/receive.c:213 process_one_work kernel/workqueue.c:3231 [inline] process_scheduled_works+0xa2c/0x1830 kernel/workqueue.c:3312 worker_thread+0x86d/0xd40 kernel/workqueue.c:3390 kthread+0x2f0/0x390 kernel/kthread.c:389 ret_from_fork+0x4b/0x80 arch/x86/kernel/process.c:144 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:244 page last free pid 5206 tgid 5206 stack trace: reset_page_owner include/linux/page_owner.h:25 [inline] free_pages_prepare mm/page_alloc.c:1093 [inline] free_unref_page+0xd22/0xea0 mm/page_alloc.c:2643 discard_slab mm/slub.c:2583 [inline] __put_partials+0xeb/0x130 mm/slub.c:3051 put_cpu_partial+0x17c/0x250 mm/slub.c:3126 __slab_free+0x2ea/0x3d0 mm/slub.c:4343 qlink_free mm/kasan/quarantine.c:163 [inline] qlist_free_all+0x9e/0x140 mm/kasan/quarantine.c:179 kasan_quarantine_reduce+0x14f/0x170 mm/kasan/quarantine.c:286 __kasan_slab_alloc+0x23/0x80 mm/kasan/common.c:322 kasan_slab_alloc include/linux/kasan.h:201 [inline] slab_post_alloc_hook mm/slub.c:3988 [inline] slab_alloc_node mm/slub.c:4037 [inline] kmem_cache_alloc_node_noprof+0x16b/0x320 mm/slub.c:4080 __alloc_skb+0x1c3/0x440 net/core/skbuff.c:664 alloc_skb include/linux/skbuff.h:1320 [inline] alloc_skb_with_frags+0xc3/0x770 net/core/skbuff.c:6526 sock_alloc_send_pskb+0x91a/0xa60 net/core/sock.c:2815 sock_alloc_send_skb include/net/sock.h:1778 [inline] mld_newpack+0x1c3/0xa90 net/ipv6/mcast.c:1746 add_grhead net/ipv6/mcast.c:1849 [inline] add_grec+0x1492/0x19a0 net/ipv6/mcast.c:1987 mld_send_cr net/ipv6/mcast.c:2113 [inline] mld_ifc_work+0x691/0xd90 net/ipv6/mcast.c:2650 process_one_work kernel/workqueue.c:3231 [inline] process_scheduled_works+0xa2c/0x1830 kernel/workqueue.c:3312 worker_thread+0x86d/0xd40 kernel/workqueue.c:3390 Memory state around the buggy address: ffff88802a3bd080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff88802a3bd100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff88802a3bd180: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff88802a3bd200: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff88802a3bd280: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ==================================================================