New bluetooth related lockdep warning
From: Hans de Goede <hidden>
Date: 2021-12-06 14:33:23
Hi,
I just got this lockdep warning on my system running a 5.16-rc3 kernel
(while using bluetooth headphones):
[ 59.956325] ======================================================
[ 59.956329] WARNING: possible circular locking dependency detected
[ 59.956334] 5.16.0-rc3+ #662 Tainted: G W E
[ 59.956340] ------------------------------------------------------
[ 59.956343] krfcommd/2230 is trying to acquire lock:
[ 59.956349] ffff8dcfc4f78920 (sk_lock-AF_BLUETOOTH-BTPROTO_RFCOMM){+.+.}-{0:0}, at: rfcomm_sk_state_change+0x4d/0x110 [rfcomm]
[ 59.956386]
but task is already holding lock:
[ 59.956390] ffff8dcf872cf328 (&d->lock){+.+.}-{3:3}, at: rfcomm_run+0x132d/0x1810 [rfcomm]
[ 59.956417]
which lock already depends on the new lock.
[ 59.956421]
the existing dependency chain (in reverse order) is:
[ 59.956424]
-> #2 (&d->lock){+.+.}-{3:3}:
[ 59.956436] __mutex_lock+0x92/0x8a0
[ 59.956450] rfcomm_run+0x132d/0x1810 [rfcomm]
[ 59.956469] kthread+0x165/0x190
[ 59.956478] ret_from_fork+0x1f/0x30
[ 59.956491]
-> #1 (rfcomm_mutex){+.+.}-{3:3}:
[ 59.956502] __mutex_lock+0x92/0x8a0
[ 59.956511] rfcomm_dlc_open+0x31/0x340 [rfcomm]
[ 59.956529] rfcomm_sock_connect+0xd3/0x130 [rfcomm]
[ 59.956549] __sys_connect+0x9f/0xd0
[ 59.956561] __x64_sys_connect+0x14/0x20
[ 59.956571] do_syscall_64+0x38/0x90
[ 59.956579] entry_SYSCALL_64_after_hwframe+0x44/0xae
[ 59.956591]
-> #0 (sk_lock-AF_BLUETOOTH-BTPROTO_RFCOMM){+.+.}-{0:0}:
[ 59.956602] __lock_acquire+0x1158/0x1de0
[ 59.956610] lock_acquire+0xb5/0x2b0
[ 59.956616] lock_sock_nested+0x2e/0x80
[ 59.956625] rfcomm_sk_state_change+0x4d/0x110 [rfcomm]
[ 59.956644] rfcomm_run+0x1346/0x1810 [rfcomm]
[ 59.956661] kthread+0x165/0x190
[ 59.956668] ret_from_fork+0x1f/0x30
[ 59.956677]
other info that might help us debug this:
[ 59.956681] Chain exists of:
sk_lock-AF_BLUETOOTH-BTPROTO_RFCOMM --> rfcomm_mutex --> &d->lock
[ 59.956694] Possible unsafe locking scenario:
[ 59.956698] CPU0 CPU1
[ 59.956701] ---- ----
[ 59.956704] lock(&d->lock);
[ 59.956710] lock(rfcomm_mutex);
[ 59.956716] lock(&d->lock);
[ 59.956722] lock(sk_lock-AF_BLUETOOTH-BTPROTO_RFCOMM);
[ 59.956728]
*** DEADLOCK ***
[ 59.956731] 2 locks held by krfcommd/2230:
[ 59.956737] #0: ffffffffc1796108 (rfcomm_mutex){+.+.}-{3:3}, at: rfcomm_run+0x135/0x1810 [rfcomm]
[ 59.956776] #1: ffff8dcf872cf328 (&d->lock){+.+.}-{3:3}, at: rfcomm_run+0x132d/0x1810 [rfcomm]
[ 59.956817]
stack backtrace:
[ 59.956823] CPU: 5 PID: 2230 Comm: krfcommd Tainted: G W E 5.16.0-rc3+ #662
[ 59.956833] Hardware name: LENOVO 20U90SIT19/20U90SIT19, BIOS N2WET30W (1.20 ) 08/26/2021
[ 59.956838] Call Trace:
[ 59.956844] <TASK>
[ 59.956851] dump_stack_lvl+0x59/0x73
[ 59.956864] check_noncircular+0xde/0x100
[ 59.956877] ? __lock_acquire+0xf7e/0x1de0
[ 59.956889] __lock_acquire+0x1158/0x1de0
[ 59.956898] ? lock_is_held_type+0xa8/0x120
[ 59.956911] lock_acquire+0xb5/0x2b0
[ 59.956918] ? rfcomm_sk_state_change+0x4d/0x110 [rfcomm]
[ 59.956937] ? rfcomm_run+0x132d/0x1810 [rfcomm]
[ 59.956955] lock_sock_nested+0x2e/0x80
[ 59.956963] ? rfcomm_sk_state_change+0x4d/0x110 [rfcomm]
[ 59.956979] rfcomm_sk_state_change+0x4d/0x110 [rfcomm]
[ 59.956996] rfcomm_run+0x1346/0x1810 [rfcomm]
[ 59.957015] ? __init_waitqueue_head+0x60/0x60
[ 59.957031] ? _raw_spin_unlock_irqrestore+0x2d/0x50
[ 59.957044] ? rfcomm_check_accept+0xa0/0xa0 [rfcomm]
[ 59.957060] kthread+0x165/0x190
[ 59.957068] ? set_kthread_struct+0x40/0x40
[ 59.957076] ret_from_fork+0x1f/0x30
[ 59.957094] </TASK>
[ 60.547040] input: Bose QC35 II (AVRCP) as /devices/virtual/input/input58
Regards,
Hans