possible deadlock in hci_conn_hash_flush (2)

Status: upstream: reported syz repro on 2024/01/23 23:43
Bug presence: origin:lts-only
[Documentation on labels]
Reported-by: syzbot+6540c42c3d5224a370e8@syzkaller.appspotmail.com
First crash: 924d, last: 17d
Fix bisection: failed (error log, bisect log)
  
Bug presence (2)
Date Name Commit Repro Result
2024/05/13 linux-5.15.y (ToT) 284087d4f7d5 syz [report] possible deadlock in hci_conn_hash_flush
2024/05/13 upstream (ToT) a38297e3fb01 syz Didn't crash
Similar bugs (4)
Kernel Title Rank 🛈 Repro Cause bisect Fix bisect Count Last Reported Patched Status
linux-6.1 possible deadlock in hci_conn_hash_flush (2) origin:lts-only 4 syz done 13 813d 889d 0/3 upstream: reported syz repro on 2024/02/27 07:43
upstream possible deadlock in hci_conn_hash_flush bluetooth 4 4 1264d 1394d 0/29 auto-obsoleted due to no activity on 2023/06/17 14:27
linux-5.15 possible deadlock in hci_conn_hash_flush 4 9 1081d 1158d 0/3 auto-obsoleted due to no activity on 2023/11/27 03:55
linux-6.1 possible deadlock in hci_conn_hash_flush 4 5 1105d 1210d 0/3 auto-obsoleted due to no activity on 2023/11/03 12:59
Last patch testing requests (10)
Created Duration User Patch Repo Result
2026/07/18 20:55 16m retest repro linux-5.15.y report log
2026/05/22 22:22 13m retest repro linux-5.15.y report log
2026/02/22 21:49 9m retest repro linux-5.15.y report log
2025/12/14 20:33 12m retest repro linux-5.15.y report log
2025/10/04 07:50 55m retest repro linux-5.15.y report log
2025/07/26 06:55 9m retest repro linux-5.15.y report log
2025/05/15 11:41 12m retest repro linux-5.15.y report log
2025/03/05 13:42 11m retest repro linux-5.15.y report log
2024/12/25 10:44 14m retest repro linux-5.15.y report log
2024/10/01 14:01 9m retest repro linux-5.15.y report log
Fix bisection attempts (2)
Created Duration User Patch Repo Result
2024/10/15 02:35 0m bisect fix linux-5.15.y error job log
2024/05/27 12:37 54m fix candidate upstream OK (0) job log log

Sample crash report:
======================================================
WARNING: possible circular locking dependency detected
syzkaller #0 Not tainted
------------------------------------------------------
syz.3.384/5699 is trying to acquire lock:
ffff888077182270 ((work_completion)(&(&conn->timeout_work)->work)){+.+.}-{0:0}, at: __flush_work+0xfa/0x210 kernel/workqueue.c:3090

but task is already holding lock:
ffffffff8d581ee8 (hci_cb_list_lock){+.+.}-{3:3}, at: hci_disconn_cfm include/net/bluetooth/hci_core.h:1519 [inline]
ffffffff8d581ee8 (hci_cb_list_lock){+.+.}-{3:3}, at: hci_conn_hash_flush+0xa4/0x220 net/bluetooth/hci_conn.c:1622

which lock already depends on the new lock.


the existing dependency chain (in reverse order) is:

-> #3 (hci_cb_list_lock){+.+.}-{3:3}:
       __mutex_lock_common+0x1e5/0x2400 kernel/locking/mutex.c:596
       __mutex_lock kernel/locking/mutex.c:729 [inline]
       mutex_lock_nested+0x17/0x20 kernel/locking/mutex.c:743
       hci_connect_cfm include/net/bluetooth/hci_core.h:1504 [inline]
       hci_remote_features_evt+0x5d9/0xa10 net/bluetooth/hci_event.c:3369
       hci_event_packet+0x600/0x1310 net/bluetooth/hci_event.c:6456
       hci_rx_work+0x255/0xa10 net/bluetooth/hci_core.c:5190
       process_one_work+0x867/0xff0 kernel/workqueue.c:2310
       worker_thread+0xad7/0x12a0 kernel/workqueue.c:2457
       kthread+0x42e/0x520 kernel/kthread.c:334
       ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:287

-> #2 (&hdev->lock){+.+.}-{3:3}:
       __mutex_lock_common+0x1e5/0x2400 kernel/locking/mutex.c:596
       __mutex_lock kernel/locking/mutex.c:729 [inline]
       mutex_lock_nested+0x17/0x20 kernel/locking/mutex.c:743
       sco_sock_connect+0x189/0x940 net/bluetooth/sco.c:602
       __sys_connect_file net/socket.c:1933 [inline]
       __sys_connect+0x3cb/0x450 net/socket.c:1950
       __do_sys_connect net/socket.c:1960 [inline]
       __se_sys_connect net/socket.c:1957 [inline]
       __x64_sys_connect+0x76/0x80 net/socket.c:1957
       do_syscall_x64 arch/x86/entry/common.c:50 [inline]
       do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:80
       entry_SYSCALL_64_after_hwframe+0x66/0xd0

-> #1 (sk_lock-AF_BLUETOOTH-BTPROTO_SCO){+.+.}-{0:0}:
       lock_sock_nested+0x44/0x100 net/core/sock.c:3259
       lock_sock include/net/sock.h:1744 [inline]
       sco_sock_timeout+0x124/0x2d0 net/bluetooth/sco.c:108
       process_one_work+0x867/0xff0 kernel/workqueue.c:2310
       worker_thread+0xad7/0x12a0 kernel/workqueue.c:2457
       kthread+0x42e/0x520 kernel/kthread.c:334
       ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:287

-> #0 ((work_completion)(&(&conn->timeout_work)->work)){+.+.}-{0:0}:
       check_prev_add kernel/locking/lockdep.c:3053 [inline]
       check_prevs_add kernel/locking/lockdep.c:3172 [inline]
       validate_chain kernel/locking/lockdep.c:3788 [inline]
       __lock_acquire+0x2c66/0x7b50 kernel/locking/lockdep.c:5012
       lock_acquire+0x19e/0x400 kernel/locking/lockdep.c:5623
       __flush_work+0x116/0x210 kernel/workqueue.c:3090
       __cancel_work_timer+0x3f4/0x560 kernel/workqueue.c:3181
       sco_conn_del+0x24c/0x350 net/bluetooth/sco.c:214
       hci_disconn_cfm include/net/bluetooth/hci_core.h:1522 [inline]
       hci_conn_hash_flush+0x107/0x220 net/bluetooth/hci_conn.c:1622
       hci_dev_do_close+0x918/0x1020 net/bluetooth/hci_core.c:1813
       hci_unregister_dev+0x2eb/0x590 net/bluetooth/hci_core.c:4070
       vhci_release+0x73/0xc0 drivers/bluetooth/hci_vhci.c:345
       __fput+0x212/0x8c0 fs/file_table.c:311
       task_work_run+0x125/0x1a0 kernel/task_work.c:188
       exit_task_work include/linux/task_work.h:33 [inline]
       do_exit+0x635/0x2110 kernel/exit.c:884
       do_group_exit+0x12c/0x2f0 kernel/exit.c:998
       get_signal+0x7eb/0x12e0 kernel/signal.c:2901
       arch_do_signal_or_restart+0xe6/0x12a0 arch/x86/kernel/signal.c:867
       handle_signal_work kernel/entry/common.c:154 [inline]
       exit_to_user_mode_loop+0x9e/0x130 kernel/entry/common.c:178
       exit_to_user_mode_prepare+0xee/0x180 kernel/entry/common.c:214
       __syscall_exit_to_user_mode_work kernel/entry/common.c:296 [inline]
       syscall_exit_to_user_mode+0x16/0x40 kernel/entry/common.c:307
       ret_from_fork+0x15/0x30 arch/x86/entry/entry_64.S:280

other info that might help us debug this:

Chain exists of:
  (work_completion)(&(&conn->timeout_work)->work) --> &hdev->lock --> hci_cb_list_lock

 Possible unsafe locking scenario:

       CPU0                    CPU1
       ----                    ----
  lock(hci_cb_list_lock);
                               lock(&hdev->lock);
                               lock(hci_cb_list_lock);
  lock((work_completion)(&(&conn->timeout_work)->work));

 *** DEADLOCK ***

3 locks held by syz.3.384/5699:
 #0: ffff88802adb13f0 (&hdev->req_lock){+.+.}-{3:3}, at: hci_dev_do_close+0x5f/0x1020 net/bluetooth/hci_core.c:1755
 #1: ffff88802adb0478 (&hdev->lock){+.+.}-{3:3}, at: hci_dev_do_close+0x408/0x1020 net/bluetooth/hci_core.c:1800
 #2: ffffffff8d581ee8 (hci_cb_list_lock){+.+.}-{3:3}, at: hci_disconn_cfm include/net/bluetooth/hci_core.h:1519 [inline]
 #2: ffffffff8d581ee8 (hci_cb_list_lock){+.+.}-{3:3}, at: hci_conn_hash_flush+0xa4/0x220 net/bluetooth/hci_conn.c:1622

stack backtrace:
CPU: 1 PID: 5699 Comm: syz.3.384 Not tainted syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 05/09/2026
Call Trace:
 <TASK>
 dump_stack_lvl+0x188/0x250 lib/dump_stack.c:106
 check_noncircular+0x296/0x330 kernel/locking/lockdep.c:2133
 check_prev_add kernel/locking/lockdep.c:3053 [inline]
 check_prevs_add kernel/locking/lockdep.c:3172 [inline]
 validate_chain kernel/locking/lockdep.c:3788 [inline]
 __lock_acquire+0x2c66/0x7b50 kernel/locking/lockdep.c:5012
 lock_acquire+0x19e/0x400 kernel/locking/lockdep.c:5623
 __flush_work+0x116/0x210 kernel/workqueue.c:3090
 __cancel_work_timer+0x3f4/0x560 kernel/workqueue.c:3181
 sco_conn_del+0x24c/0x350 net/bluetooth/sco.c:214
 hci_disconn_cfm include/net/bluetooth/hci_core.h:1522 [inline]
 hci_conn_hash_flush+0x107/0x220 net/bluetooth/hci_conn.c:1622
 hci_dev_do_close+0x918/0x1020 net/bluetooth/hci_core.c:1813
 hci_unregister_dev+0x2eb/0x590 net/bluetooth/hci_core.c:4070
 vhci_release+0x73/0xc0 drivers/bluetooth/hci_vhci.c:345
 __fput+0x212/0x8c0 fs/file_table.c:311
 task_work_run+0x125/0x1a0 kernel/task_work.c:188
 exit_task_work include/linux/task_work.h:33 [inline]
 do_exit+0x635/0x2110 kernel/exit.c:884
 do_group_exit+0x12c/0x2f0 kernel/exit.c:998
 get_signal+0x7eb/0x12e0 kernel/signal.c:2901
 arch_do_signal_or_restart+0xe6/0x12a0 arch/x86/kernel/signal.c:867
 handle_signal_work kernel/entry/common.c:154 [inline]
 exit_to_user_mode_loop+0x9e/0x130 kernel/entry/common.c:178
 exit_to_user_mode_prepare+0xee/0x180 kernel/entry/common.c:214
 __syscall_exit_to_user_mode_work kernel/entry/common.c:296 [inline]
 syscall_exit_to_user_mode+0x16/0x40 kernel/entry/common.c:307
 ret_from_fork+0x15/0x30 arch/x86/entry/entry_64.S:280
RIP: 0033:0x7f2ecbbc7e59
Code: Unable to access opcode bytes at RIP 0x7f2ecbbc7e2f.
RSP: 002b:00007f2ecb228fd8 EFLAGS: 00000206 ORIG_RAX: 0000000000000038
RAX: 0000000000000000 RBX: 00007f2ecbe40fa0 RCX: 00007f2ecbbc7e59
RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000008000000
RBP: 00007f2ecbc5de6f R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000206 R12: 0000000000000000
R13: 00007f2ecbe41038 R14: 00007f2ecbe40fa0 R15: 00007ffcc7f7ee08
 </TASK>

Crashes (7):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2026/06/27 19:12 linux-5.15.y eceeec79dbc6 fb92f11c .config console log report syz / log [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan possible deadlock in hci_conn_hash_flush
2024/05/13 12:31 linux-5.15.y 284087d4f7d5 9026e142 .config console log report syz [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan possible deadlock in hci_conn_hash_flush
2025/05/30 16:37 linux-5.15.y 98f47d0e9b8c 3d2f584d .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan possible deadlock in hci_conn_hash_flush
2024/05/13 10:01 linux-5.15.y 284087d4f7d5 9026e142 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan possible deadlock in hci_conn_hash_flush
2024/05/04 18:31 linux-5.15.y 284087d4f7d5 610f2a54 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan possible deadlock in hci_conn_hash_flush
2024/02/26 21:32 linux-5.15.y 458ce51d0356 da36a36b .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan possible deadlock in hci_conn_hash_flush
2024/01/23 23:42 linux-5.15.y ddcaf4999061 1e153dc8 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan possible deadlock in hci_conn_hash_flush
* Struck through repros no longer work on HEAD.