From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1B5D23E559E; Tue, 31 Mar 2026 16:37:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774975027; cv=none; b=uGSR16I5zp2/WHp240gCmUrnCpIYXtigGMqlzmtcrF3LT3eap+K0kb0Yxx0oxbPDzQBBfIXnP2e+BJmIzzyv8QsGn3VZ8eE+gkvpVX7ZfMZ71NFK8FRQ7W6ZLAviuB4udXZqxW2lmB4bMfnQ0qKt2Ppx69hYnmtZ+snR/Wpdlmw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774975027; c=relaxed/simple; bh=30s3aiYpbE0v70qhxFdE1j2SwGTsem8lE4bEejknTzw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=WwD8XUDQZ3eylIXuhIixuvtl3attdsQUpzvwQ5MZpEZByfVZancBmO8JPIOMYpxA8xXAcvA4QW8L+z8yrkOxejlHZQVVPCJll5TL4bUF5eO+oS59V4kbeTvM2yqY69ts6OsilCWTDp0Nv93kj7jrGwq9lhSZOyo0+JMOq6Gs9V8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=euUCk6Hn; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="euUCk6Hn" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1114AC19424; Tue, 31 Mar 2026 16:37:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1774975026; bh=30s3aiYpbE0v70qhxFdE1j2SwGTsem8lE4bEejknTzw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=euUCk6HnPzOBnoKDHhyFbm29N2lg80Dy4gfNyQyjOrCIOZAgQIUmaOHLksIlB5z0w oIKCFpGIwf5uoSAoD/H/Smmn5ugfWs/PWb8KsmHgRTtmbaaqPAzApf3JvrOjPKbutm BGek0Wg3wBNRlLeSrCOJynJEOJW3yZ3oiiQBFhwg= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Hyunwoo Kim , Luiz Augusto von Dentz , Sasha Levin Subject: [PATCH 6.19 136/342] Bluetooth: L2CAP: Fix deadlock in l2cap_conn_del() Date: Tue, 31 Mar 2026 18:19:29 +0200 Message-ID: <20260331161804.013152264@linuxfoundation.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260331161758.909578033@linuxfoundation.org> References: <20260331161758.909578033@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.19-stable review patch. If anyone has any objections, please let me know. ------------------ From: Hyunwoo Kim [ 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 Signed-off-by: Luiz Augusto von Dentz Signed-off-by: Sasha Levin --- 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 5bd5561a8dbf5..734cbb5dc1bfa 100644 --- a/net/bluetooth/l2cap_core.c +++ b/net/bluetooth/l2cap_core.c @@ -1748,6 +1748,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); @@ -1763,8 +1766,6 @@ static void l2cap_conn_del(struct hci_conn *hcon, int err) ida_destroy(&conn->tx_ida); - cancel_delayed_work_sync(&conn->id_addr_timer); - l2cap_unregister_all_users(conn); /* Force the connection to be immediately dropped */ @@ -1783,9 +1784,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.51.0