syzbot


possible deadlock in rfcomm_dlc_exists

Status: upstream: reported on 2023/03/24 03:20
Reported-by: syzbot+8e4c71cb4113a8a02b5b@syzkaller.appspotmail.com
First crash: 620d, last: 47d
Similar bugs (2)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
linux-5.15 possible deadlock in rfcomm_dlc_exists origin:upstream C error 388 48d 620d 0/3 upstream: reported C repro on 2023/03/23 21:28
upstream possible deadlock in rfcomm_dlc_exists bluetooth C error done 13649 49d 683d 0/28 upstream: reported C repro on 2023/01/20 16:28

Sample crash report:
======================================================
WARNING: possible circular locking dependency detected
6.1.112-syzkaller #0 Not tainted
------------------------------------------------------
syz.3.1328/10842 is trying to acquire lock:
ffffffff8e6762e8 (rfcomm_mutex){+.+.}-{3:3}, at: rfcomm_dlc_exists+0xa2/0x370 net/bluetooth/rfcomm/core.c:542

but task is already holding lock:
ffffffff8e679ce8 (rfcomm_ioctl_mutex){+.+.}-{3:3}, at: rfcomm_create_dev net/bluetooth/rfcomm/tty.c:484 [inline]
ffffffff8e679ce8 (rfcomm_ioctl_mutex){+.+.}-{3:3}, at: rfcomm_dev_ioctl+0x233/0x2180 net/bluetooth/rfcomm/tty.c:587

which lock already depends on the new lock.


the existing dependency chain (in reverse order) is:

-> #3 (rfcomm_ioctl_mutex){+.+.}-{3:3}:
       lock_acquire+0x1f8/0x5a0 kernel/locking/lockdep.c:5662
       __mutex_lock_common kernel/locking/mutex.c:603 [inline]
       __mutex_lock+0x132/0xd80 kernel/locking/mutex.c:747
       rfcomm_create_dev net/bluetooth/rfcomm/tty.c:484 [inline]
       rfcomm_dev_ioctl+0x233/0x2180 net/bluetooth/rfcomm/tty.c:587
       rfcomm_sock_ioctl+0x82/0xc0 net/bluetooth/rfcomm/sock.c:869
       sock_do_ioctl+0x152/0x450 net/socket.c:1204
       sock_ioctl+0x47f/0x770 net/socket.c:1321
       vfs_ioctl fs/ioctl.c:51 [inline]
       __do_sys_ioctl fs/ioctl.c:870 [inline]
       __se_sys_ioctl+0xf1/0x160 fs/ioctl.c:856
       do_syscall_x64 arch/x86/entry/common.c:51 [inline]
       do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:81
       entry_SYSCALL_64_after_hwframe+0x68/0xd2

-> #2 (sk_lock-AF_BLUETOOTH-BTPROTO_RFCOMM){+.+.}-{0:0}:
       lock_acquire+0x1f8/0x5a0 kernel/locking/lockdep.c:5662
       lock_sock_nested+0x44/0x100 net/core/sock.c:3485
       lock_sock include/net/sock.h:1748 [inline]
       rfcomm_sk_state_change+0x57/0x300 net/bluetooth/rfcomm/sock.c:73
       __rfcomm_dlc_close+0x2b2/0x6d0 net/bluetooth/rfcomm/core.c:489
       rfcomm_dlc_close+0xed/0x180 net/bluetooth/rfcomm/core.c:520
       __rfcomm_sock_close+0x104/0x220 net/bluetooth/rfcomm/sock.c:220
       rfcomm_sock_shutdown+0xb4/0x230 net/bluetooth/rfcomm/sock.c:901
       rfcomm_sock_release+0x55/0x110 net/bluetooth/rfcomm/sock.c:922
       __sock_release net/socket.c:654 [inline]
       sock_close+0xcd/0x230 net/socket.c:1400
       __fput+0x3f6/0x8d0 fs/file_table.c:320
       task_work_run+0x246/0x300 kernel/task_work.c:203
       get_signal+0x15fc/0x17d0 kernel/signal.c:2647
       arch_do_signal_or_restart+0xb0/0x1a10 arch/x86/kernel/signal.c:871
       exit_to_user_mode_loop+0x6a/0x100 kernel/entry/common.c:174
       exit_to_user_mode_prepare+0xb1/0x140 kernel/entry/common.c:210
       __syscall_exit_to_user_mode_work kernel/entry/common.c:292 [inline]
       syscall_exit_to_user_mode+0x60/0x270 kernel/entry/common.c:303
       do_syscall_64+0x47/0xb0 arch/x86/entry/common.c:87
       entry_SYSCALL_64_after_hwframe+0x68/0xd2

-> #1 (&d->lock){+.+.}-{3:3}:
       lock_acquire+0x1f8/0x5a0 kernel/locking/lockdep.c:5662
       __mutex_lock_common kernel/locking/mutex.c:603 [inline]
       __mutex_lock+0x132/0xd80 kernel/locking/mutex.c:747
       __rfcomm_dlc_close+0x259/0x6d0 net/bluetooth/rfcomm/core.c:487
       rfcomm_dlc_close+0xed/0x180 net/bluetooth/rfcomm/core.c:520
       __rfcomm_sock_close+0x104/0x220 net/bluetooth/rfcomm/sock.c:220
       rfcomm_sock_shutdown+0xb4/0x230 net/bluetooth/rfcomm/sock.c:901
       rfcomm_sock_release+0x55/0x110 net/bluetooth/rfcomm/sock.c:922
       __sock_release net/socket.c:654 [inline]
       sock_close+0xcd/0x230 net/socket.c:1400
       __fput+0x3f6/0x8d0 fs/file_table.c:320
       task_work_run+0x246/0x300 kernel/task_work.c:203
       get_signal+0x15fc/0x17d0 kernel/signal.c:2647
       arch_do_signal_or_restart+0xb0/0x1a10 arch/x86/kernel/signal.c:871
       exit_to_user_mode_loop+0x6a/0x100 kernel/entry/common.c:174
       exit_to_user_mode_prepare+0xb1/0x140 kernel/entry/common.c:210
       __syscall_exit_to_user_mode_work kernel/entry/common.c:292 [inline]
       syscall_exit_to_user_mode+0x60/0x270 kernel/entry/common.c:303
       do_syscall_64+0x47/0xb0 arch/x86/entry/common.c:87
       entry_SYSCALL_64_after_hwframe+0x68/0xd2

-> #0 (rfcomm_mutex){+.+.}-{3:3}:
       check_prev_add kernel/locking/lockdep.c:3090 [inline]
       check_prevs_add kernel/locking/lockdep.c:3209 [inline]
       validate_chain+0x1661/0x5950 kernel/locking/lockdep.c:3825
       __lock_acquire+0x125b/0x1f80 kernel/locking/lockdep.c:5049
       lock_acquire+0x1f8/0x5a0 kernel/locking/lockdep.c:5662
       __mutex_lock_common kernel/locking/mutex.c:603 [inline]
       __mutex_lock+0x132/0xd80 kernel/locking/mutex.c:747
       rfcomm_dlc_exists+0xa2/0x370 net/bluetooth/rfcomm/core.c:542
       __rfcomm_create_dev net/bluetooth/rfcomm/tty.c:414 [inline]
       rfcomm_create_dev net/bluetooth/rfcomm/tty.c:485 [inline]
       rfcomm_dev_ioctl+0xb2d/0x2180 net/bluetooth/rfcomm/tty.c:587
       rfcomm_sock_ioctl+0x82/0xc0 net/bluetooth/rfcomm/sock.c:869
       sock_do_ioctl+0x152/0x450 net/socket.c:1204
       sock_ioctl+0x47f/0x770 net/socket.c:1321
       vfs_ioctl fs/ioctl.c:51 [inline]
       __do_sys_ioctl fs/ioctl.c:870 [inline]
       __se_sys_ioctl+0xf1/0x160 fs/ioctl.c:856
       do_syscall_x64 arch/x86/entry/common.c:51 [inline]
       do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:81
       entry_SYSCALL_64_after_hwframe+0x68/0xd2

other info that might help us debug this:

Chain exists of:
  rfcomm_mutex --> sk_lock-AF_BLUETOOTH-BTPROTO_RFCOMM --> rfcomm_ioctl_mutex

 Possible unsafe locking scenario:

       CPU0                    CPU1
       ----                    ----
  lock(rfcomm_ioctl_mutex);
                               lock(sk_lock-AF_BLUETOOTH-BTPROTO_RFCOMM);
                               lock(rfcomm_ioctl_mutex);
  lock(rfcomm_mutex);

 *** DEADLOCK ***

2 locks held by syz.3.1328/10842:
 #0: ffff88802cc32130 (sk_lock-AF_BLUETOOTH-BTPROTO_RFCOMM){+.+.}-{0:0}, at: lock_sock include/net/sock.h:1748 [inline]
 #0: ffff88802cc32130 (sk_lock-AF_BLUETOOTH-BTPROTO_RFCOMM){+.+.}-{0:0}, at: rfcomm_sock_ioctl+0x74/0xc0 net/bluetooth/rfcomm/sock.c:868
 #1: ffffffff8e679ce8 (rfcomm_ioctl_mutex){+.+.}-{3:3}, at: rfcomm_create_dev net/bluetooth/rfcomm/tty.c:484 [inline]
 #1: ffffffff8e679ce8 (rfcomm_ioctl_mutex){+.+.}-{3:3}, at: rfcomm_dev_ioctl+0x233/0x2180 net/bluetooth/rfcomm/tty.c:587

stack backtrace:
CPU: 0 PID: 10842 Comm: syz.3.1328 Not tainted 6.1.112-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/13/2024
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0x1e3/0x2cb lib/dump_stack.c:106
 check_noncircular+0x2fa/0x3b0 kernel/locking/lockdep.c:2170
 check_prev_add kernel/locking/lockdep.c:3090 [inline]
 check_prevs_add kernel/locking/lockdep.c:3209 [inline]
 validate_chain+0x1661/0x5950 kernel/locking/lockdep.c:3825
 __lock_acquire+0x125b/0x1f80 kernel/locking/lockdep.c:5049
 lock_acquire+0x1f8/0x5a0 kernel/locking/lockdep.c:5662
 __mutex_lock_common kernel/locking/mutex.c:603 [inline]
 __mutex_lock+0x132/0xd80 kernel/locking/mutex.c:747
 rfcomm_dlc_exists+0xa2/0x370 net/bluetooth/rfcomm/core.c:542
 __rfcomm_create_dev net/bluetooth/rfcomm/tty.c:414 [inline]
 rfcomm_create_dev net/bluetooth/rfcomm/tty.c:485 [inline]
 rfcomm_dev_ioctl+0xb2d/0x2180 net/bluetooth/rfcomm/tty.c:587
 rfcomm_sock_ioctl+0x82/0xc0 net/bluetooth/rfcomm/sock.c:869
 sock_do_ioctl+0x152/0x450 net/socket.c:1204
 sock_ioctl+0x47f/0x770 net/socket.c:1321
 vfs_ioctl fs/ioctl.c:51 [inline]
 __do_sys_ioctl fs/ioctl.c:870 [inline]
 __se_sys_ioctl+0xf1/0x160 fs/ioctl.c:856
 do_syscall_x64 arch/x86/entry/common.c:51 [inline]
 do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:81
 entry_SYSCALL_64_after_hwframe+0x68/0xd2
RIP: 0033:0x7fa5c317dff9
Code: ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 a8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007fa5c3efd038 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
RAX: ffffffffffffffda RBX: 00007fa5c3336130 RCX: 00007fa5c317dff9
RDX: 0000000020000100 RSI: 00000000400452c8 RDI: 000000000000000b
RBP: 00007fa5c31f0296 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 0000000000000000 R14: 00007fa5c3336130 R15: 00007ffdfedf2768
 </TASK>

Crashes (335):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2024/10/17 04:15 linux-6.1.y aa4cd140bba5 666f77ed .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in rfcomm_dlc_exists
2024/10/17 01:09 linux-6.1.y aa4cd140bba5 666f77ed .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in rfcomm_dlc_exists
2024/10/16 13:31 linux-6.1.y aa4cd140bba5 bde2d81c .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in rfcomm_dlc_exists
2024/10/16 12:18 linux-6.1.y aa4cd140bba5 bde2d81c .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in rfcomm_dlc_exists
2024/10/15 22:21 linux-6.1.y aa4cd140bba5 bde2d81c .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in rfcomm_dlc_exists
2024/10/15 10:06 linux-6.1.y aa4cd140bba5 7eb57b4a .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in rfcomm_dlc_exists
2024/10/15 08:26 linux-6.1.y aa4cd140bba5 b01b6661 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in rfcomm_dlc_exists
2024/10/11 22:15 linux-6.1.y aa4cd140bba5 084d8178 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in rfcomm_dlc_exists
2024/10/11 22:15 linux-6.1.y aa4cd140bba5 084d8178 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in rfcomm_dlc_exists
2024/10/10 16:49 linux-6.1.y aa4cd140bba5 8fbfc0c8 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in rfcomm_dlc_exists
2024/10/07 16:57 linux-6.1.y aa4cd140bba5 d7906eff .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in rfcomm_dlc_exists
2024/10/03 15:37 linux-6.1.y aa4cd140bba5 d7906eff .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in rfcomm_dlc_exists
2024/10/03 08:38 linux-6.1.y aa4cd140bba5 a4c7fd36 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in rfcomm_dlc_exists
2024/10/02 01:53 linux-6.1.y aa4cd140bba5 ea2b66a6 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in rfcomm_dlc_exists
2024/09/30 21:20 linux-6.1.y aa4cd140bba5 bbd4e0a4 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in rfcomm_dlc_exists
2024/09/30 16:04 linux-6.1.y aa4cd140bba5 bbd4e0a4 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in rfcomm_dlc_exists
2024/09/30 13:37 linux-6.1.y e526b12bf916 bbd4e0a4 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in rfcomm_dlc_exists
2024/09/28 10:50 linux-6.1.y e526b12bf916 ba29ff75 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in rfcomm_dlc_exists
2024/09/27 23:52 linux-6.1.y e526b12bf916 440b26ec .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in rfcomm_dlc_exists
2024/09/26 22:12 linux-6.1.y e526b12bf916 9314348a .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in rfcomm_dlc_exists
2024/09/24 20:44 linux-6.1.y e526b12bf916 5643e0e9 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in rfcomm_dlc_exists
2024/09/23 16:16 linux-6.1.y e526b12bf916 89298aad .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in rfcomm_dlc_exists
2024/09/20 13:41 linux-6.1.y e526b12bf916 6f888b75 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in rfcomm_dlc_exists
2024/09/06 18:51 linux-6.1.y 699506173494 9750182a .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in rfcomm_dlc_exists
2024/09/04 09:33 linux-6.1.y 311d8503ef9f 9d47f20a .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in rfcomm_dlc_exists
2024/09/04 09:33 linux-6.1.y 311d8503ef9f 9d47f20a .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in rfcomm_dlc_exists
2024/08/10 08:15 linux-6.1.y 48d525b0e463 6f4edef4 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in rfcomm_dlc_exists
2024/07/30 18:00 linux-6.1.y c1cec4dad96b 6fde257d .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in rfcomm_dlc_exists
2024/07/11 15:50 linux-6.1.y 266ee8e06d5b c699c2eb .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in rfcomm_dlc_exists
2024/07/05 19:04 linux-6.1.y 7753af06eebf 2a40360c .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in rfcomm_dlc_exists
2024/05/01 06:26 linux-6.1.y dcbc050cb0d3 3ba885bc .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in rfcomm_dlc_exists
2024/04/29 00:33 linux-6.1.y f2295faba5e8 07b455f9 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in rfcomm_dlc_exists
2024/10/17 09:31 linux-6.1.y aa4cd140bba5 666f77ed .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in rfcomm_dlc_exists
2024/10/14 21:19 linux-6.1.y aa4cd140bba5 b01b6661 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in rfcomm_dlc_exists
2024/10/09 13:08 linux-6.1.y aa4cd140bba5 56fb2cb7 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in rfcomm_dlc_exists
2024/10/08 05:04 linux-6.1.y aa4cd140bba5 402f1df0 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in rfcomm_dlc_exists
2024/10/03 03:15 linux-6.1.y aa4cd140bba5 a4c7fd36 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in rfcomm_dlc_exists
2024/10/02 12:37 linux-6.1.y aa4cd140bba5 02f9582a .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in rfcomm_dlc_exists
2024/10/01 12:43 linux-6.1.y aa4cd140bba5 ea2b66a6 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in rfcomm_dlc_exists
2024/09/22 08:11 linux-6.1.y e526b12bf916 6f888b75 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in rfcomm_dlc_exists
2024/09/14 20:35 linux-6.1.y 5f55cad62cc9 08d8a733 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in rfcomm_dlc_exists
2024/09/04 21:36 linux-6.1.y 699506173494 dfbe2ed4 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in rfcomm_dlc_exists
2024/08/19 12:51 linux-6.1.y ee5e09825b81 9f0ab3fb .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in rfcomm_dlc_exists
2024/08/11 13:13 linux-6.1.y 36790ef5e00b 6f4edef4 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in rfcomm_dlc_exists
2024/07/19 08:40 linux-6.1.y 9b3f9a5b12dc ee4e11c8 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in rfcomm_dlc_exists
2024/05/02 00:56 linux-6.1.y dcbc050cb0d3 3ba885bc .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in rfcomm_dlc_exists
2024/04/29 23:10 linux-6.1.y dcbc050cb0d3 f10afd69 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in rfcomm_dlc_exists
2023/03/24 03:19 linux-6.1.y e3a87a10f259 f94b4a29 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in rfcomm_dlc_exists
* Struck through repros no longer work on HEAD.