====================================================== WARNING: possible circular locking dependency detected 5.15.0-rc4-next-20211008-syzkaller #0 Not tainted ------------------------------------------------------ krfcommd/2714 is trying to acquire lock: ffff88807acaf120 (sk_lock-AF_BLUETOOTH-BTPROTO_RFCOMM){+.+.}-{0:0}, at: lock_sock include/net/sock.h:1637 [inline] ffff88807acaf120 (sk_lock-AF_BLUETOOTH-BTPROTO_RFCOMM){+.+.}-{0:0}, at: rfcomm_sk_state_change+0x63/0x300 net/bluetooth/rfcomm/sock.c:73 but task is already holding lock: ffff8880737bdd28 (&d->lock){+.+.}-{3:3}, at: __rfcomm_dlc_close+0x281/0x480 net/bluetooth/rfcomm/core.c:487 which lock already depends on the new lock. the existing dependency chain (in reverse order) is: -> #2 (&d->lock){+.+.}-{3:3}: lock_acquire+0x19f/0x4d0 kernel/locking/lockdep.c:5637 __mutex_lock_common+0x1d5/0x2590 kernel/locking/mutex.c:599 __mutex_lock kernel/locking/mutex.c:732 [inline] mutex_lock_nested+0x1a/0x20 kernel/locking/mutex.c:784 __rfcomm_dlc_close+0x281/0x480 net/bluetooth/rfcomm/core.c:487 rfcomm_process_dlcs+0x92/0x620 net/bluetooth/rfcomm/core.c:1880 rfcomm_process_sessions+0x2f6/0x3f0 net/bluetooth/rfcomm/core.c:2039 rfcomm_run+0x195/0x2c0 net/bluetooth/rfcomm/core.c:2122 kthread+0x468/0x490 kernel/kthread.c:327 ret_from_fork+0x1f/0x30 -> #1 (rfcomm_mutex){+.+.}-{3:3}: lock_acquire+0x19f/0x4d0 kernel/locking/lockdep.c:5637 __mutex_lock_common+0x1d5/0x2590 kernel/locking/mutex.c:599 __mutex_lock kernel/locking/mutex.c:732 [inline] mutex_lock_nested+0x1a/0x20 kernel/locking/mutex.c:784 rfcomm_dlc_open+0x25/0x50 net/bluetooth/rfcomm/core.c:425 rfcomm_sock_connect+0x285/0x470 net/bluetooth/rfcomm/sock.c:413 __sys_connect_file net/socket.c:1896 [inline] __sys_connect+0x29b/0x2d0 net/socket.c:1913 __do_sys_connect net/socket.c:1923 [inline] __se_sys_connect net/socket.c:1920 [inline] __x64_sys_connect+0x76/0x80 net/socket.c:1920 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x44/0xd0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x44/0xae -> #0 (sk_lock-AF_BLUETOOTH-BTPROTO_RFCOMM){+.+.}-{0:0}: check_prev_add kernel/locking/lockdep.c:3063 [inline] check_prevs_add kernel/locking/lockdep.c:3186 [inline] validate_chain+0x1dfb/0x8240 kernel/locking/lockdep.c:3801 __lock_acquire+0x1382/0x2b00 kernel/locking/lockdep.c:5027 lock_acquire+0x19f/0x4d0 kernel/locking/lockdep.c:5637 lock_sock_nested+0x4a/0x100 net/core/sock.c:3272 lock_sock include/net/sock.h:1637 [inline] rfcomm_sk_state_change+0x63/0x300 net/bluetooth/rfcomm/sock.c:73 __rfcomm_dlc_close+0x2cc/0x480 net/bluetooth/rfcomm/core.c:489 rfcomm_process_dlcs+0x92/0x620 net/bluetooth/rfcomm/core.c:1880 rfcomm_process_sessions+0x2f6/0x3f0 net/bluetooth/rfcomm/core.c:2039 rfcomm_run+0x195/0x2c0 net/bluetooth/rfcomm/core.c:2122 kthread+0x468/0x490 kernel/kthread.c:327 ret_from_fork+0x1f/0x30 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 *** 2 locks held by krfcommd/2714: #0: ffffffff8ded4ea8 (rfcomm_mutex){+.+.}-{3:3}, at: rfcomm_process_sessions+0x21/0x3f0 net/bluetooth/rfcomm/core.c:2015 #1: ffff8880737bdd28 (&d->lock){+.+.}-{3:3}, at: __rfcomm_dlc_close+0x281/0x480 net/bluetooth/rfcomm/core.c:487 stack backtrace: CPU: 0 PID: 2714 Comm: krfcommd Not tainted 5.15.0-rc4-next-20211008-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0x1dc/0x2d8 lib/dump_stack.c:106 check_noncircular+0x2f9/0x3b0 kernel/locking/lockdep.c:2143 check_prev_add kernel/locking/lockdep.c:3063 [inline] check_prevs_add kernel/locking/lockdep.c:3186 [inline] validate_chain+0x1dfb/0x8240 kernel/locking/lockdep.c:3801 __lock_acquire+0x1382/0x2b00 kernel/locking/lockdep.c:5027 lock_acquire+0x19f/0x4d0 kernel/locking/lockdep.c:5637 lock_sock_nested+0x4a/0x100 net/core/sock.c:3272 lock_sock include/net/sock.h:1637 [inline] rfcomm_sk_state_change+0x63/0x300 net/bluetooth/rfcomm/sock.c:73 __rfcomm_dlc_close+0x2cc/0x480 net/bluetooth/rfcomm/core.c:489 rfcomm_process_dlcs+0x92/0x620 net/bluetooth/rfcomm/core.c:1880 rfcomm_process_sessions+0x2f6/0x3f0 net/bluetooth/rfcomm/core.c:2039 rfcomm_run+0x195/0x2c0 net/bluetooth/rfcomm/core.c:2122 kthread+0x468/0x490 kernel/kthread.c:327 ret_from_fork+0x1f/0x30