* [PATCH 6.12.y] Bluetooth: L2CAP: Fix deadlock in l2cap_conn_del()
@ 2026-05-11 7:44 Wenshan Lan
2026-05-11 14:21 ` Sasha Levin
0 siblings, 1 reply; 2+ messages in thread
From: Wenshan Lan @ 2026-05-11 7:44 UTC (permalink / raw)
To: gregkh, sashal, stable
Cc: linux-kernel, Hyunwoo Kim, Luiz Augusto von Dentz, Wenshan Lan
From: Hyunwoo Kim <imv4bel@gmail.com>
[ Upstream commit 00fdebbbc557a2fc21321ff2eaa22fd70c078608 ]
l2cap_conn_del() calls cancel_delayed_work_sync() for both info_timer
and id_addr_timer while holding conn->lock. However, the work functions
l2cap_info_timeout() and l2cap_conn_update_id_addr() both acquire
conn->lock, creating a potential AB-BA deadlock if the work is already
executing when l2cap_conn_del() takes the lock.
Move the work cancellations before acquiring conn->lock and use
disable_delayed_work_sync() to additionally prevent the works from
being rearmed after cancellation, consistent with the pattern used in
hci_conn_del().
Fixes: ab4eedb790ca ("Bluetooth: L2CAP: Fix corrupted list in hci_chan_del")
Signed-off-by: Hyunwoo Kim <imv4bel@gmail.com>
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
[ Minor context conflict resolved. ]
Signed-off-by: Wenshan Lan <jetlan9@163.com>
---
net/bluetooth/l2cap_core.c | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c
index 128f5701efb4..307f7fe975b5 100644
--- a/net/bluetooth/l2cap_core.c
+++ b/net/bluetooth/l2cap_core.c
@@ -1756,6 +1756,9 @@ static void l2cap_conn_del(struct hci_conn *hcon, int err)
BT_DBG("hcon %p conn %p, err %d", hcon, conn, err);
+ disable_delayed_work_sync(&conn->info_timer);
+ disable_delayed_work_sync(&conn->id_addr_timer);
+
mutex_lock(&conn->lock);
kfree_skb(conn->rx_skb);
@@ -1769,8 +1772,6 @@ static void l2cap_conn_del(struct hci_conn *hcon, int err)
if (work_pending(&conn->pending_rx_work))
cancel_work_sync(&conn->pending_rx_work);
- cancel_delayed_work_sync(&conn->id_addr_timer);
-
l2cap_unregister_all_users(conn);
/* Force the connection to be immediately dropped */
@@ -1789,9 +1790,6 @@ static void l2cap_conn_del(struct hci_conn *hcon, int err)
l2cap_chan_put(chan);
}
- if (conn->info_state & L2CAP_INFO_FEAT_MASK_REQ_SENT)
- cancel_delayed_work_sync(&conn->info_timer);
-
hci_chan_del(conn->hchan);
conn->hchan = NULL;
--
2.43.0
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH 6.12.y] Bluetooth: L2CAP: Fix deadlock in l2cap_conn_del()
2026-05-11 7:44 [PATCH 6.12.y] Bluetooth: L2CAP: Fix deadlock in l2cap_conn_del() Wenshan Lan
@ 2026-05-11 14:21 ` Sasha Levin
0 siblings, 0 replies; 2+ messages in thread
From: Sasha Levin @ 2026-05-11 14:21 UTC (permalink / raw)
To: gregkh, stable
Cc: Sasha Levin, linux-kernel, Hyunwoo Kim, Luiz Augusto von Dentz,
Wenshan Lan
On Mon, May 11, 2026 at 03:44:11PM +0800, Wenshan Lan wrote:
> From: Hyunwoo Kim <imv4bel@gmail.com>
>
> [ Upstream commit 00fdebbbc557a2fc21321ff2eaa22fd70c078608 ]
>
> l2cap_conn_del() calls cancel_delayed_work_sync() for both info_timer
> and id_addr_timer while holding conn->lock.
Queued for 6.12, thanks.
--
Sasha
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-05-11 14:22 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-11 7:44 [PATCH 6.12.y] Bluetooth: L2CAP: Fix deadlock in l2cap_conn_del() Wenshan Lan
2026-05-11 14:21 ` Sasha Levin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox