From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796387070; b=YunEJKGtF8RNPhcVqhVfFeQM5BbHuSoVlorMIGff3X2JWvXLL8QnnbhpuUNHWW0+A/ak 0DHC1UuN0RH7ITOPG7SSXdCLeywtPTk3P+SF4Hr9aall051+FR7ploOveNKmwJZ4vMEbq HFxjW/1U/4K+LSmDBzIqmIxntbBtIJJ9/b11LjXcTnDVWfhPwYid1uwN9Ch/jIrP8qRte xtVNoo34lcO074w3kj2HT4rbbckev00ru+bjMyYHdIQLnfPdSmuAWenzxcl3J1XafzxiL UA54fZRx3wg+21LZZ5upEcw4SyfZWKOU94g8h9sNn6UyUOxK+Ja5eGxiaQqKgYkPacQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796387070; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:User-Agent:X-stable:X-Patchwork-Hint: MIME-Version:Content-Transfer-Encoding; bh=taYeMx7lQPAUbth+t5hnkqMpO3WxtZHeXnsCuiMNa04=; b=p+NHVQkmoATaTBKVnCp9zXkxVmpH4hT0bX7FXJ1c6746IABSWym/5VekDBYV/0pEDZAo 1grQ2sKwrVuWTjphXk+VGp4o+wD0MPd+s6IYm45a6GKPyysGIK5GOIaZP5PgANSMuoFJA YHBKaZE98vd4TVcmQUH7WKaiYQ/+1BDAgTVEXZqA1iy4lSSMhfgpIQR7Bkny6Y0bkMQ1t nAkb5BMtaQ8gYb/5Kj+DhkU2c+zJIe84HQ1nEbs1BRm5e6uTGySeleTIKXnTlTR+bO4TF XSXPvIA6ge0RxEXidc6SkCIez7lzAEOdJYcqEn7iScWXnojmuyHMpC5CT5gUkGjALnQ== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=xBNovejz; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C532E606A322; Fri, 4 Dec 2026 12:24:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=xBNovejz Received: by smtp.kernel.org (Postfix) with ESMTPSA id 40E701F000CE; Fri, 4 Dec 2026 12:24:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796387070; bh=taYeMx7lQPAUbth+t5hnkqMpO3WxtZHeXnsCuiMNa04=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=xBNovejzk9bEAqu9DUrE0xBuOzxApNgcgzdE4g+9/rSkXqtbZUn7bOWgeVa5MaUxs 0T5GWeYDm4Ul2Il+qAJKMDGknjiok/7GsQq8bjYikR034YHipnjhyAn3BSKM61BNHC p2u7Zx1gCXUS2S8I9pB+3OTlj2irnuqRCrl5O4tA= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Zhao Li , Luiz Augusto von Dentz , Sasha Levin Subject: [PATCH 6.1 0121/1059] Bluetooth: L2CAP: Clear request identifiers on incoming LE connections Date: Fri, 4 Dec 2026 18:54:12 +0900 Message-ID: <20261204100647.359225599@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100643.980430235@linuxfoundation.org> References: <20261204100643.980430235@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: patches@lists.linux.dev List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.1-stable review patch. If anyone has any objections, please let me know. ------------------ From: Zhao Li [ Upstream commit 15a80cc8263abd50132a05d1b06824de8e28abcb ] Incoming LE and ECRED channels retain the peer's request identifier after an immediate response. The deferred LE response also leaves the identifier set, unlike the deferred ECRED response. A later ECRED request can reuse that identifier and include an unrelated channel in its shared-response handling. That walk matches on the identifier alone, so an LE channel is selected too. If the old channel is closing, the checks can refuse the new connection. The check at request receipt rejects it with L2CAP_CR_LE_INVALID_PARAMS; the check before a deferred response returns L2CAP_CR_LE_AUTHORIZATION. Store the identifier only when deferring the response, and clear it after sending the deferred LE response. Keep deferred ECRED identifiers until the shared response is sent, since a partially accepted group still needs them. AI assistance was used. Fixes: 27e2d4c8d28b ("Bluetooth: Add basic LE L2CAP connect request receiving support") Fixes: 15f02b910562 ("Bluetooth: L2CAP: Add initial code for Enhanced Credit Based Mode") Signed-off-by: Zhao Li Signed-off-by: Luiz Augusto von Dentz Signed-off-by: Sasha Levin --- net/bluetooth/l2cap_core.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c index d7bb1193132fe..86e229a593f83 100644 --- a/net/bluetooth/l2cap_core.c +++ b/net/bluetooth/l2cap_core.c @@ -3891,6 +3891,7 @@ void __l2cap_le_connect_rsp_defer(struct l2cap_chan *chan) l2cap_send_cmd(conn, chan->ident, L2CAP_LE_CONN_RSP, sizeof(rsp), &rsp); + chan->ident = 0; } static void l2cap_ecred_list_defer(struct l2cap_chan *chan, void *data) @@ -5166,10 +5167,10 @@ static int l2cap_le_connect_req(struct l2cap_conn *conn, __set_chan_timer(chan, chan->ops->get_sndtimeo(chan)); - chan->ident = cmd->ident; chan->mode = L2CAP_MODE_LE_FLOWCTL; if (test_bit(FLAG_DEFER_SETUP, &chan->flags)) { + chan->ident = cmd->ident; l2cap_state_change(chan, BT_CONNECT2); /* The following result value is actually not defined * for LE CoC but we use it to let the function know @@ -5398,10 +5399,10 @@ static inline int l2cap_ecred_conn_req(struct l2cap_conn *conn, __set_chan_timer(chan, chan->ops->get_sndtimeo(chan)); - chan->ident = cmd->ident; chan->mode = L2CAP_MODE_EXT_FLOWCTL; if (test_bit(FLAG_DEFER_SETUP, &chan->flags)) { + chan->ident = cmd->ident; l2cap_state_change(chan, BT_CONNECT2); defer = true; chan->ops->defer(chan); -- 2.53.0