====================================================== WARNING: possible circular locking dependency detected 6.4.0-rc1-syzkaller #0 Not tainted ------------------------------------------------------ syz-executor.2/5513 is trying to acquire lock: ffff88807bf75130 (sk_lock-AF_BLUETOOTH-BTPROTO_RFCOMM){+.+.}-{0:0}, at: lock_sock include/net/sock.h:1697 [inline] (sk_lock-AF_BLUETOOTH-BTPROTO_RFCOMM){+.+.}-{0:0}, at: rfcomm_sk_state_change+0x5b/0x300 net/bluetooth/rfcomm/sock.c:73 but task is already holding lock: ffff888069a88128 (&d->lock){+.+.}-{3:3}, at: __rfcomm_dlc_close+0x222/0x690 net/bluetooth/rfcomm/core.c:491 which lock already depends on the new lock. the existing dependency chain (in reverse order) is: -> #3 (&d->lock){+.+.}-{3:3}: lock_acquire+0x1e3/0x520 kernel/locking/lockdep.c:5691 __mutex_lock_common+0x1d8/0x2530 kernel/locking/mutex.c:603 __mutex_lock kernel/locking/mutex.c:747 [inline] mutex_lock_nested+0x1b/0x20 kernel/locking/mutex.c:799 __rfcomm_dlc_close+0x222/0x690 net/bluetooth/rfcomm/core.c:491 rfcomm_dlc_close+0xf1/0x190 net/bluetooth/rfcomm/core.c:524 __rfcomm_sock_close+0x121/0x250 net/bluetooth/rfcomm/sock.c:220 rfcomm_sock_shutdown+0xb8/0x240 net/bluetooth/rfcomm/sock.c:912 rfcomm_sock_release+0x59/0x120 net/bluetooth/rfcomm/sock.c:933 __sock_release net/socket.c:653 [inline] sock_close+0xd1/0x230 net/socket.c:1397 __fput+0x3b7/0x890 fs/file_table.c:321 task_work_run+0x24a/0x300 kernel/task_work.c:179 get_signal+0x1606/0x17e0 kernel/signal.c:2650 arch_do_signal_or_restart+0x91/0x600 arch/x86/kernel/signal.c:306 exit_to_user_mode_loop+0x6a/0x100 kernel/entry/common.c:168 exit_to_user_mode_prepare+0xb1/0x140 kernel/entry/common.c:204 __syscall_exit_to_user_mode_work kernel/entry/common.c:286 [inline] syscall_exit_to_user_mode+0x64/0x280 kernel/entry/common.c:297 do_syscall_64+0x4d/0x90 arch/x86/entry/common.c:86 entry_SYSCALL_64_after_hwframe+0x63/0xcd -> #2 (rfcomm_mutex){+.+.}-{3:3}: lock_acquire+0x1e3/0x520 kernel/locking/lockdep.c:5691 __mutex_lock_common+0x1d8/0x2530 kernel/locking/mutex.c:603 __mutex_lock kernel/locking/mutex.c:747 [inline] mutex_lock_nested+0x1b/0x20 kernel/locking/mutex.c:799 rfcomm_dlc_exists+0xa6/0x370 net/bluetooth/rfcomm/core.c:546 __rfcomm_create_dev net/bluetooth/rfcomm/tty.c:414 [inline] rfcomm_create_dev net/bluetooth/rfcomm/tty.c:485 [inline] rfcomm_dev_ioctl+0xb31/0x21a0 net/bluetooth/rfcomm/tty.c:587 rfcomm_sock_ioctl+0x86/0xd0 net/bluetooth/rfcomm/sock.c:880 sock_do_ioctl+0x10e/0x440 net/socket.c:1201 sock_ioctl+0x5dd/0x850 net/socket.c:1318 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:50 [inline] do_syscall_64+0x41/0x90 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd -> #1 (rfcomm_ioctl_mutex){+.+.}-{3:3}: lock_acquire+0x1e3/0x520 kernel/locking/lockdep.c:5691 __mutex_lock_common+0x1d8/0x2530 kernel/locking/mutex.c:603 __mutex_lock kernel/locking/mutex.c:747 [inline] mutex_lock_nested+0x1b/0x20 kernel/locking/mutex.c:799 rfcomm_create_dev net/bluetooth/rfcomm/tty.c:484 [inline] rfcomm_dev_ioctl+0x237/0x21a0 net/bluetooth/rfcomm/tty.c:587 rfcomm_sock_ioctl+0x86/0xd0 net/bluetooth/rfcomm/sock.c:880 sock_do_ioctl+0x10e/0x440 net/socket.c:1201 sock_ioctl+0x5dd/0x850 net/socket.c:1318 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:50 [inline] do_syscall_64+0x41/0x90 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd -> #0 (sk_lock-AF_BLUETOOTH-BTPROTO_RFCOMM){+.+.}-{0:0}: check_prev_add kernel/locking/lockdep.c:3108 [inline] check_prevs_add kernel/locking/lockdep.c:3227 [inline] validate_chain+0x166b/0x58e0 kernel/locking/lockdep.c:3842 __lock_acquire+0x1295/0x2000 kernel/locking/lockdep.c:5074 lock_acquire+0x1e3/0x520 kernel/locking/lockdep.c:5691 lock_sock_nested+0x48/0x100 net/core/sock.c:3469 lock_sock include/net/sock.h:1697 [inline] rfcomm_sk_state_change+0x5b/0x300 net/bluetooth/rfcomm/sock.c:73 __rfcomm_dlc_close+0x268/0x690 net/bluetooth/rfcomm/core.c:493 rfcomm_dlc_close+0xf1/0x190 net/bluetooth/rfcomm/core.c:524 __rfcomm_sock_close+0x121/0x250 net/bluetooth/rfcomm/sock.c:220 rfcomm_sock_shutdown+0xb8/0x240 net/bluetooth/rfcomm/sock.c:912 rfcomm_sock_release+0x59/0x120 net/bluetooth/rfcomm/sock.c:933 __sock_release net/socket.c:653 [inline] sock_close+0xd1/0x230 net/socket.c:1397 __fput+0x3b7/0x890 fs/file_table.c:321 task_work_run+0x24a/0x300 kernel/task_work.c:179 get_signal+0x1606/0x17e0 kernel/signal.c:2650 arch_do_signal_or_restart+0x91/0x600 arch/x86/kernel/signal.c:306 exit_to_user_mode_loop+0x6a/0x100 kernel/entry/common.c:168 exit_to_user_mode_prepare+0xb1/0x140 kernel/entry/common.c:204 __syscall_exit_to_user_mode_work kernel/entry/common.c:286 [inline] syscall_exit_to_user_mode+0x64/0x280 kernel/entry/common.c:297 do_syscall_64+0x4d/0x90 arch/x86/entry/common.c:86 entry_SYSCALL_64_after_hwframe+0x63/0xcd other info that might help us debug this: Chain exists of: sk_lock-AF_BLUETOOTH-BTPROTO_RFCOMM --> rfcomm_mutex --> &d->lock Possible unsafe locking scenario: CPU0 CPU1 ---- ---- lock(&d->lock); lock(rfcomm_mutex); lock(&d->lock); lock(sk_lock-AF_BLUETOOTH-BTPROTO_RFCOMM); *** DEADLOCK *** 3 locks held by syz-executor.2/5513: #0: ffff88806d757a10 (&sb->s_type->i_mutex_key#10){+.+.}-{3:3}, at: inode_lock include/linux/fs.h:775 [inline] #0: ffff88806d757a10 (&sb->s_type->i_mutex_key#10){+.+.}-{3:3}, at: __sock_release net/socket.c:652 [inline] #0: ffff88806d757a10 (&sb->s_type->i_mutex_key#10){+.+.}-{3:3}, at: sock_close+0x9c/0x230 net/socket.c:1397 #1: ffffffff8e215be8 (rfcomm_mutex){+.+.}-{3:3}, at: rfcomm_dlc_close+0x3b/0x190 net/bluetooth/rfcomm/core.c:511 #2: ffff888069a88128 (&d->lock){+.+.}-{3:3}, at: __rfcomm_dlc_close+0x222/0x690 net/bluetooth/rfcomm/core.c:491 stack backtrace: CPU: 1 PID: 5513 Comm: syz-executor.2 Not tainted 6.4.0-rc1-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 04/14/2023 Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0x1e7/0x2d0 lib/dump_stack.c:106 check_noncircular+0x2fe/0x3b0 kernel/locking/lockdep.c:2188 check_prev_add kernel/locking/lockdep.c:3108 [inline] check_prevs_add kernel/locking/lockdep.c:3227 [inline] validate_chain+0x166b/0x58e0 kernel/locking/lockdep.c:3842 __lock_acquire+0x1295/0x2000 kernel/locking/lockdep.c:5074 lock_acquire+0x1e3/0x520 kernel/locking/lockdep.c:5691 lock_sock_nested+0x48/0x100 net/core/sock.c:3469 lock_sock include/net/sock.h:1697 [inline] rfcomm_sk_state_change+0x5b/0x300 net/bluetooth/rfcomm/sock.c:73 __rfcomm_dlc_close+0x268/0x690 net/bluetooth/rfcomm/core.c:493 rfcomm_dlc_close+0xf1/0x190 net/bluetooth/rfcomm/core.c:524 __rfcomm_sock_close+0x121/0x250 net/bluetooth/rfcomm/sock.c:220 rfcomm_sock_shutdown+0xb8/0x240 net/bluetooth/rfcomm/sock.c:912 rfcomm_sock_release+0x59/0x120 net/bluetooth/rfcomm/sock.c:933 __sock_release net/socket.c:653 [inline] sock_close+0xd1/0x230 net/socket.c:1397 __fput+0x3b7/0x890 fs/file_table.c:321 task_work_run+0x24a/0x300 kernel/task_work.c:179 get_signal+0x1606/0x17e0 kernel/signal.c:2650 arch_do_signal_or_restart+0x91/0x600 arch/x86/kernel/signal.c:306 exit_to_user_mode_loop+0x6a/0x100 kernel/entry/common.c:168 exit_to_user_mode_prepare+0xb1/0x140 kernel/entry/common.c:204 __syscall_exit_to_user_mode_work kernel/entry/common.c:286 [inline] syscall_exit_to_user_mode+0x64/0x280 kernel/entry/common.c:297 do_syscall_64+0x4d/0x90 arch/x86/entry/common.c:86 entry_SYSCALL_64_after_hwframe+0x63/0xcd RIP: 0033:0x7fa35028c0f9 Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 f1 19 00 00 90 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 b8 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007fa350f0b168 EFLAGS: 00000246 ORIG_RAX: 000000000000002a RAX: fffffffffffffffc RBX: 00007fa3503abf80 RCX: 00007fa35028c0f9 RDX: 000000000000000a RSI: 0000000020000000 RDI: 0000000000000004 RBP: 00007fa3502e7b39 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 00007ffd8f2ce51f R14: 00007fa350f0b300 R15: 0000000000022000