====================================================== WARNING: possible circular locking dependency detected 6.12.0-rc7-syzkaller-g887407160d72 #0 Not tainted ------------------------------------------------------ kworker/u9:6/6435 is trying to acquire lock: ffff0000d5667258 (sk_lock-AF_BLUETOOTH-BTPROTO_SCO){+.+.}-{0:0}, at: lock_sock include/net/sock.h:1611 [inline] ffff0000d5667258 (sk_lock-AF_BLUETOOTH-BTPROTO_SCO){+.+.}-{0:0}, at: sco_conn_ready net/bluetooth/sco.c:1296 [inline] ffff0000d5667258 (sk_lock-AF_BLUETOOTH-BTPROTO_SCO){+.+.}-{0:0}, at: sco_connect_cfm+0x3e8/0x94c net/bluetooth/sco.c:1368 but task is already holding lock: ffff0000d2de0420 (&conn->lock#2){+.+.}-{2:2}, at: spin_lock include/linux/spinlock.h:351 [inline] ffff0000d2de0420 (&conn->lock#2){+.+.}-{2:2}, at: sco_conn_ready net/bluetooth/sco.c:1283 [inline] ffff0000d2de0420 (&conn->lock#2){+.+.}-{2:2}, at: sco_connect_cfm+0x260/0x94c net/bluetooth/sco.c:1368 which lock already depends on the new lock. the existing dependency chain (in reverse order) is: -> #1 (&conn->lock#2){+.+.}-{2:2}: __raw_spin_lock include/linux/spinlock_api_smp.h:133 [inline] _raw_spin_lock+0x48/0x60 kernel/locking/spinlock.c:154 spin_lock include/linux/spinlock.h:351 [inline] sco_chan_add net/bluetooth/sco.c:240 [inline] sco_connect net/bluetooth/sco.c:293 [inline] sco_sock_connect+0x2bc/0x820 net/bluetooth/sco.c:602 __sys_connect_file net/socket.c:2071 [inline] __sys_connect+0x268/0x290 net/socket.c:2088 __do_sys_connect net/socket.c:2098 [inline] __se_sys_connect net/socket.c:2095 [inline] __arm64_sys_connect+0x7c/0x94 net/socket.c:2095 __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 -> #0 (sk_lock-AF_BLUETOOTH-BTPROTO_SCO){+.+.}-{0:0}: check_prev_add kernel/locking/lockdep.c:3161 [inline] check_prevs_add kernel/locking/lockdep.c:3280 [inline] validate_chain kernel/locking/lockdep.c:3904 [inline] __lock_acquire+0x33f8/0x77c8 kernel/locking/lockdep.c:5202 lock_acquire+0x240/0x728 kernel/locking/lockdep.c:5825 lock_sock_nested+0x5c/0x11c net/core/sock.c:3611 lock_sock include/net/sock.h:1611 [inline] sco_conn_ready net/bluetooth/sco.c:1296 [inline] sco_connect_cfm+0x3e8/0x94c net/bluetooth/sco.c:1368 hci_connect_cfm include/net/bluetooth/hci_core.h:1960 [inline] hci_sync_conn_complete_evt+0x438/0x870 net/bluetooth/hci_event.c:5009 hci_event_func net/bluetooth/hci_event.c:7443 [inline] hci_event_packet+0x8dc/0x106c net/bluetooth/hci_event.c:7495 hci_rx_work+0x324/0xaf0 net/bluetooth/hci_core.c:4031 process_one_work+0x7bc/0x1600 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 other info that might help us debug this: Possible unsafe locking scenario: CPU0 CPU1 ---- ---- lock(&conn->lock#2); lock(sk_lock-AF_BLUETOOTH-BTPROTO_SCO); lock(&conn->lock#2); lock(sk_lock-AF_BLUETOOTH-BTPROTO_SCO); *** DEADLOCK *** 5 locks held by kworker/u9:6/6435: #0: ffff0000db3ac148 ((wq_completion)hci2#2){+.+.}-{0:0}, at: process_one_work+0x628/0x1600 kernel/workqueue.c:3203 #1: ffff8000a3b87c20 ((work_completion)(&hdev->rx_work)){+.+.}-{0:0}, at: process_one_work+0x6bc/0x1600 kernel/workqueue.c:3203 #2: ffff0000d5438078 (&hdev->lock){+.+.}-{3:3}, at: hci_sync_conn_complete_evt+0xa4/0x870 net/bluetooth/hci_event.c:4926 #3: ffff800092885708 (hci_cb_list_lock){+.+.}-{3:3}, at: hci_connect_cfm include/net/bluetooth/hci_core.h:1957 [inline] #3: ffff800092885708 (hci_cb_list_lock){+.+.}-{3:3}, at: hci_sync_conn_complete_evt+0x3d4/0x870 net/bluetooth/hci_event.c:5009 #4: ffff0000d2de0420 (&conn->lock#2){+.+.}-{2:2}, at: spin_lock include/linux/spinlock.h:351 [inline] #4: ffff0000d2de0420 (&conn->lock#2){+.+.}-{2:2}, at: sco_conn_ready net/bluetooth/sco.c:1283 [inline] #4: ffff0000d2de0420 (&conn->lock#2){+.+.}-{2:2}, at: sco_connect_cfm+0x260/0x94c net/bluetooth/sco.c:1368 stack backtrace: CPU: 1 UID: 0 PID: 6435 Comm: kworker/u9:6 Not tainted 6.12.0-rc7-syzkaller-g887407160d72 #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/13/2024 Workqueue: hci2 hci_rx_work Call trace: show_stack+0x2c/0x3c arch/arm64/kernel/stacktrace.c:484 (C) __dump_stack lib/dump_stack.c:94 [inline] dump_stack_lvl+0xe4/0x150 lib/dump_stack.c:120 dump_stack+0x1c/0x28 lib/dump_stack.c:129 print_circular_bug+0x154/0x1c0 kernel/locking/lockdep.c:2074 check_noncircular+0x310/0x404 kernel/locking/lockdep.c:2206 check_prev_add kernel/locking/lockdep.c:3161 [inline] check_prevs_add kernel/locking/lockdep.c:3280 [inline] validate_chain kernel/locking/lockdep.c:3904 [inline] __lock_acquire+0x33f8/0x77c8 kernel/locking/lockdep.c:5202 lock_acquire+0x240/0x728 kernel/locking/lockdep.c:5825 lock_sock_nested+0x5c/0x11c net/core/sock.c:3611 lock_sock include/net/sock.h:1611 [inline] sco_conn_ready net/bluetooth/sco.c:1296 [inline] sco_connect_cfm+0x3e8/0x94c net/bluetooth/sco.c:1368 hci_connect_cfm include/net/bluetooth/hci_core.h:1960 [inline] hci_sync_conn_complete_evt+0x438/0x870 net/bluetooth/hci_event.c:5009 hci_event_func net/bluetooth/hci_event.c:7443 [inline] hci_event_packet+0x8dc/0x106c net/bluetooth/hci_event.c:7495 hci_rx_work+0x324/0xaf0 net/bluetooth/hci_core.c:4031 process_one_work+0x7bc/0x1600 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 BUG: sleeping function called from invalid context at net/core/sock.c:3613 in_atomic(): 1, irqs_disabled(): 0, non_block: 0, pid: 6435, name: kworker/u9:6 preempt_count: 1, expected: 0 RCU nest depth: 0, expected: 0 INFO: lockdep is turned off. Preemption disabled at: [] spin_lock include/linux/spinlock.h:351 [inline] [] sco_conn_ready net/bluetooth/sco.c:1283 [inline] [] sco_connect_cfm+0x260/0x94c net/bluetooth/sco.c:1368 CPU: 1 UID: 0 PID: 6435 Comm: kworker/u9:6 Not tainted 6.12.0-rc7-syzkaller-g887407160d72 #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/13/2024 Workqueue: hci2 hci_rx_work Call trace: show_stack+0x2c/0x3c arch/arm64/kernel/stacktrace.c:484 (C) __dump_stack lib/dump_stack.c:94 [inline] dump_stack_lvl+0xe4/0x150 lib/dump_stack.c:120 dump_stack+0x1c/0x28 lib/dump_stack.c:129 __might_resched+0x374/0x4d0 kernel/sched/core.c:8653 __might_sleep+0x90/0xe4 kernel/sched/core.c:8582 lock_sock_nested+0x6c/0x11c net/core/sock.c:3613 lock_sock include/net/sock.h:1611 [inline] sco_conn_ready net/bluetooth/sco.c:1296 [inline] sco_connect_cfm+0x3e8/0x94c net/bluetooth/sco.c:1368 hci_connect_cfm include/net/bluetooth/hci_core.h:1960 [inline] hci_sync_conn_complete_evt+0x438/0x870 net/bluetooth/hci_event.c:5009 hci_event_func net/bluetooth/hci_event.c:7443 [inline] hci_event_packet+0x8dc/0x106c net/bluetooth/hci_event.c:7495 hci_rx_work+0x324/0xaf0 net/bluetooth/hci_core.c:4031 process_one_work+0x7bc/0x1600 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 ================================================================== BUG: KASAN: slab-use-after-free in debug_spin_lock_before kernel/locking/spinlock_debug.c:86 [inline] BUG: KASAN: slab-use-after-free in do_raw_spin_lock+0x21c/0x334 kernel/locking/spinlock_debug.c:115 Read of size 4 at addr ffff0000d56671c4 by task kworker/u9:6/6435 CPU: 1 UID: 0 PID: 6435 Comm: kworker/u9:6 Tainted: G W 6.12.0-rc7-syzkaller-g887407160d72 #0 Tainted: [W]=WARN Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/13/2024 Workqueue: hci2 hci_rx_work Call trace: show_stack+0x2c/0x3c arch/arm64/kernel/stacktrace.c:484 (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:377 [inline] print_report+0x198/0x538 mm/kasan/report.c:488 kasan_report+0xd8/0x138 mm/kasan/report.c:601 __asan_report_load4_noabort+0x20/0x2c mm/kasan/report_generic.c:380 debug_spin_lock_before kernel/locking/spinlock_debug.c:86 [inline] do_raw_spin_lock+0x21c/0x334 kernel/locking/spinlock_debug.c:115 __raw_spin_lock_bh include/linux/spinlock_api_smp.h:127 [inline] _raw_spin_lock_bh+0x50/0x60 kernel/locking/spinlock.c:178 spin_lock_bh include/linux/spinlock.h:356 [inline] lock_sock_nested+0x74/0x11c net/core/sock.c:3614 lock_sock include/net/sock.h:1611 [inline] sco_conn_ready net/bluetooth/sco.c:1296 [inline] sco_connect_cfm+0x3e8/0x94c net/bluetooth/sco.c:1368 hci_connect_cfm include/net/bluetooth/hci_core.h:1960 [inline] hci_sync_conn_complete_evt+0x438/0x870 net/bluetooth/hci_event.c:5009 hci_event_func net/bluetooth/hci_event.c:7443 [inline] hci_event_packet+0x8dc/0x106c net/bluetooth/hci_event.c:7495 hci_rx_work+0x324/0xaf0 net/bluetooth/hci_core.c:4031 process_one_work+0x7bc/0x1600 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 Allocated by task 7430: 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:565 poison_kmalloc_redzone mm/kasan/common.c:377 [inline] __kasan_kmalloc+0xac/0xc4 mm/kasan/common.c:394 kasan_kmalloc include/linux/kasan.h:257 [inline] __do_kmalloc_node mm/slub.c:4264 [inline] __kmalloc_noprof+0x2a4/0x49c mm/slub.c:4276 kmalloc_noprof include/linux/slab.h:882 [inline] sk_prot_alloc+0xc4/0x1f0 net/core/sock.c:2164 sk_alloc+0x44/0x3f0 net/core/sock.c:2217 bt_sock_alloc+0x4c/0x304 net/bluetooth/af_bluetooth.c:148 sco_sock_alloc net/bluetooth/sco.c:506 [inline] sco_sock_create+0xbc/0x31c net/bluetooth/sco.c:537 bt_sock_create+0x14c/0x248 net/bluetooth/af_bluetooth.c:132 __sock_create+0x43c/0x8a0 net/socket.c:1576 sock_create net/socket.c:1632 [inline] __sys_socket_create net/socket.c:1669 [inline] __sys_socket+0x134/0x340 net/socket.c:1716 __do_sys_socket net/socket.c:1730 [inline] __se_sys_socket net/socket.c:1728 [inline] __arm64_sys_socket+0x7c/0x94 net/socket.c:1728 __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 7424: 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:579 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:230 [inline] slab_free_hook mm/slub.c:2342 [inline] slab_free mm/slub.c:4579 [inline] kfree+0x184/0x47c mm/slub.c:4727 sk_prot_free net/core/sock.c:2200 [inline] __sk_destruct+0x4b8/0x74c net/core/sock.c:2292 sk_destruct net/core/sock.c:2307 [inline] __sk_free+0x388/0x4f4 net/core/sock.c:2318 sk_free+0x60/0xc8 net/core/sock.c:2329 sock_put include/net/sock.h:1888 [inline] sco_sock_kill+0xfc/0x1b4 net/bluetooth/sco.c:437 sco_sock_release+0x1fc/0x2c0 net/bluetooth/sco.c:1265 __sock_release net/socket.c:658 [inline] sock_close+0xa4/0x1e8 net/socket.c:1426 __fput+0x1bc/0x75c fs/file_table.c:431 ____fput+0x20/0x30 fs/file_table.c:459 task_work_run+0x230/0x2e0 kernel/task_work.c:239 resume_user_mode_work include/linux/resume_user_mode.h:50 [inline] do_notify_resume+0x178/0x1f4 arch/arm64/kernel/entry-common.c:151 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 The buggy address belongs to the object at ffff0000d5667000 which belongs to the cache kmalloc-2k of size 2048 The buggy address is located 452 bytes inside of freed 2048-byte region [ffff0000d5667000, ffff0000d5667800) The buggy address belongs to the physical page: page: refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x115660 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 ffff0000c0002000 dead000000000100 dead000000000122 raw: 0000000000000000 0000000000080008 00000001f5000000 0000000000000000 head: 05ffc00000000040 ffff0000c0002000 dead000000000100 dead000000000122 head: 0000000000000000 0000000000080008 00000001f5000000 0000000000000000 head: 05ffc00000000003 fffffdffc3559801 ffffffffffffffff 0000000000000000 head: 0000000000000008 0000000000000000 00000000ffffffff 0000000000000000 page dumped because: kasan: bad access detected Memory state around the buggy address: ffff0000d5667080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff0000d5667100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff0000d5667180: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff0000d5667200: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff0000d5667280: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ================================================================== Unable to handle kernel NULL pointer dereference at virtual address 0000000000000000 Mem abort info: ESR = 0x0000000096000006 EC = 0x25: DABT (current EL), IL = 32 bits SET = 0, FnV = 0 EA = 0, S1PTW = 0 FSC = 0x06: level 2 translation fault Data abort info: ISV = 0, ISS = 0x00000006, ISS2 = 0x00000000 CM = 0, WnR = 0, TnD = 0, TagAccess = 0 GCS = 0, Overlay = 0, DirtyBit = 0, Xs = 0 user pgtable: 4k pages, 48-bit VAs, pgdp=0000000128ad5000 [0000000000000000] pgd=08000001166d2403, p4d=08000001166d2403, pud=080000011254b403, pmd=0000000000000000 Internal error: Oops: 0000000096000006 [#1] PREEMPT SMP Modules linked in: CPU: 1 UID: 0 PID: 6435 Comm: kworker/u9:6 Tainted: G B W 6.12.0-rc7-syzkaller-g887407160d72 #0 Tainted: [B]=BAD_PAGE, [W]=WARN Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/13/2024 Workqueue: hci2 hci_rx_work pstate: 20400005 (nzCv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--) pc : __pi_memcpy_generic+0x24/0x22c arch/arm64/lib/memcpy.S:71 lr : __asan_memcpy+0x68/0x84 mm/kasan/shadow.c:109 sp : ffff8000a3b87720 x29: ffff8000a3b87720 x28: 1ffff00014770ef8 x27: dfff800000000000 x26: 1fffe0001aaccead x25: ffff0000ebed93c4 x24: ffff0000d5667568 x23: ffff0000ebed9000 x22: ffff800082cb9578 x21: ffff0000d1f3c9c0 x20: 0000000000000000 x19: 0000000000000020 x18: ffff0001b36709a8 x17: ffff800080271648 x16: ffff80008b3eab5c x15: 0000000000000004 x14: 1fffe0001a3e7938 x13: 0000000000000000 x12: 0000000000000000 x11: ffff60001a3e793c x10: 1fffe0001a3e793b x9 : dfff800000000000 x8 : 0000000000000001 x7 : 0000000000000000 x6 : ffff80008a5bcc64 x5 : ffff0000d1f3c9e0 x4 : 0000000000000020 x3 : ffff800082cb9578 x2 : 0000000000000020 x1 : 0000000000000000 x0 : ffff0000d1f3c9c0 Call trace: __pi_memcpy_generic+0x24/0x22c arch/arm64/lib/memcpy.S:70 (P) __asan_memcpy+0x68/0x84 mm/kasan/shadow.c:109 (L) smack_sk_clone_security+0x7c/0x90 security/smack/smack_lsm.c:2465 security_sk_clone+0x90/0x194 security/security.c:4856 sco_sock_init net/bluetooth/sco.c:491 [inline] sco_conn_ready net/bluetooth/sco.c:1306 [inline] sco_connect_cfm+0x57c/0x94c net/bluetooth/sco.c:1368 hci_connect_cfm include/net/bluetooth/hci_core.h:1960 [inline] hci_sync_conn_complete_evt+0x438/0x870 net/bluetooth/hci_event.c:5009 hci_event_func net/bluetooth/hci_event.c:7443 [inline] hci_event_packet+0x8dc/0x106c net/bluetooth/hci_event.c:7495 hci_rx_work+0x324/0xaf0 net/bluetooth/hci_core.c:4031 process_one_work+0x7bc/0x1600 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 Code: f100805f 540003c8 f100405f 540000c3 (a9401c26) ---[ end trace 0000000000000000 ]--- ---------------- Code disassembly (best guess): 0: f100805f cmp x2, #0x20 4: 540003c8 b.hi 0x7c // b.pmore 8: f100405f cmp x2, #0x10 c: 540000c3 b.cc 0x24 // b.lo, b.ul, b.last * 10: a9401c26 ldp x6, x7, [x1] <-- trapping instruction