From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=109.224.244.16 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796322847; b=IU1Xgz/61EnrcoEfX9XRSiDnJn/2d1rBlznD0wAkUnkby8/O0gnIJlJOWFyvECpYVMbQ 4LuItCXvshqpI+xNOTOpfLfcghROixaeS/AmToLcUknGyhWRJBoSPocgcRwVA2wVThNEv ca405jHzNqpz4Dif+Zwb37/b+3CvAD30U7b9ZslU2XSI8EN3q84KWxf7v+9c1p3mSYzrw O1QXssJIwwEQhNUs41WdUp5hHDsgjADdBpbLMXVecHu1KCraHfxa9i0bKr+7T68I74ijL 9znq4BJA7vdkGfndPAhQjPt/IexTWgUMpK00aaPfMd4vQKl8OkJc5BFJKDmGXOQYVdg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796322847; h=DMARC-Filter:DKIM-Signature:Date:To:From:Cc:Subject:Message-ID: In-Reply-To:References:Feedback-ID:X-Pm-Message-ID:MIME-Version: Content-Type:Content-Transfer-Encoding; bh=8KKRu3WUM7Hak/ANDGiajE6KSDP6q6qQuiOTXHcmxfs=; b=LLFZL9zA2Llr78dzXXrRHqyJE6Oon4oSOajbLjiLbiCRKxE/1OtkN2yChfqgbi98GBb+ Qb13n+SyOELItzbTueyJqctjw576HfTAlHXsiE3j8HgKv+DwCfeYXTcjEky2C/n9HAAyr pfwtEMEbqaqykw1GClualXJXBVdLFPA8wOqFtl/FDgtzHj6LS9/sbhJ8+ELq3TghdONOS SUE0ASZjxuEvI//kYdRtEqtF09DYkaYivXoOL9KVglAC/psqAETfgdAOA+F621iMUwGyN nd/Za2ztmTrYb6opzyitHWJM7JfH7rUx33l4IY/V5LSaMIpmg9VxYthxFLD6DD/0DuA== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=proton.me; spf=pass smtp.mailfrom=proton.me; dkim=pass header.d=proton.me header.i=@proton.me header.a=rsa-sha256 header.s=protonmail2 header.b=rRa6Fzb6; arc=none smtp.remote-ip=109.224.244.16 Received: from mail-24416.protonmail.ch (mail-24416.protonmail.ch [109.224.244.16]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6D18E606A684 for ; Thu, 3 Dec 2026 18:34:06 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 6D18E606A684 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=proton.me Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=proton.me Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key, unprotected) header.d=proton.me header.i=@proton.me header.a=rsa-sha256 header.s=protonmail2 header.b=rRa6Fzb6 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=proton.me; s=protonmail2; t=1796322843; x=1796582043; bh=8KKRu3WUM7Hak/ANDGiajE6KSDP6q6qQuiOTXHcmxfs=; h=Date:To:From:Cc:Subject:Message-ID:In-Reply-To:References: Feedback-ID:From:To:Cc:Date:Subject:Reply-To:Feedback-ID: Message-ID:BIMI-Selector; b=rRa6Fzb6BI4OqV2uCa0uwZrhOEeKSp6+qoKUG+yLT0fz1v1RVDDoUdc4bU84MFrUE 7QPQbah+Tq3RvDh2LYy8lUd8bpO1YV3cRF7IFVNRUFdnqUY+ebGZPcLPX5u0PyiX33 5d5GiWr+RWbxgzt/65wuVvMDjGtcjpcSxGy9rmYbzNV6MUF4X7UNiHwbTBNCPR4Id+ 8xxmejA49TEd0o/3JAlW0kqeQUNXJCWh4S2NZg5wdPMbnHc4/YACEoQ6u89sHy/H2P jN0SdI+4m/tL/pwyc0CaasHg4UNMSdw6VQ5N/gET1VFiQTcTLaFO+dNSrzeRSVt3ja 47sDxq1zfqg6A== Date: Thu, 03 Dec 2026 18:34:00 +0000 To: linux-bluetooth@vger.kernel.org From: Kyle Pepper Cc: luiz.dentz@gmail.com, marcel@holtmann.org Subject: [PATCH v17] Bluetooth: L2CAP: Restrict LE credits to connected CoCs Message-ID: <20261203183345.111691-1-cochcoder@proton.me> In-Reply-To: <20261201022855.1483888-1-cochcoder@proton.me> References: <20261113030556.75484-1-cochcoder@proton.me> <4278a9caf4dc8e949092452c141a5be465ec77e1.1794550328.git.github.filter194@slmail.me> <4278a9caf4dc8e949092452c141a5be465ec77e1.1794617024.git.github.filter194@slmail.me> <9d9d37680044266dbd1d6919b08564026afcd87d.1795528595.git.github.filter194@slmail.me> <6aff9cb5ebb1f1512734d5ecdac876a2cc0c86bc.1795650070.git.github.filter194@slmail.me> <6aff9cb5ebb1f1512734d5ecdac876a2cc0c86bc.1795807576.git.github.filter194@slmail.me> <20261201022855.1483888-1-cochcoder@proton.me> Feedback-ID: 97716137:user:proton X-Pm-Message-ID: f1e4f19c62d5cf660acc97d0cfe39895f1f85bee X-Mailing-List: linux-bluetooth@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Only established LE credit-based channels can use a credit indication. Check the channel state and mode under the channel lock before checking for credit overflow, adding credits, or resuming transmission. Ignore credits for other channels instead of acting on them or saving them. AI assistance: gpt-6.2-sol Fixes: fad5fc89594d ("Bluetooth: Add LE flow control discipline") Signed-off-by: Kyle Pepper --- Changes in v17: - Keep the state/mode guard as a standalone patch. - Drop v16 patch 2/2. Do not add security-confirmation work or change security completion. - Rebase onto bluetooth-next at 738af1958d2e. Validation: exact-base replay and warning-free GCC W=3D1 compilation of l2cap_core.o passed. Strict CheckPatch passed with the commit lookup and sign-off checks excluded for the unsigned archive-based review. No runtime testing. v16: https://lore.kernel.org/linux-bluetooth/20261201022855.1483888-1-cochcoder@= proton.me/ net/bluetooth/l2cap_core.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c --- a/net/bluetooth/l2cap_core.c +++ b/net/bluetooth/l2cap_core.c @@ -5572,6 +5572,11 @@ static inline int l2cap_le_credits(struct l2cap_conn= *conn, =20 =09l2cap_chan_lock(chan); =20 +=09if (chan->state !=3D BT_CONNECTED || +=09 (chan->mode !=3D L2CAP_MODE_LE_FLOWCTL && +=09 chan->mode !=3D L2CAP_MODE_EXT_FLOWCTL)) +=09=09goto unlock; + =09max_credits =3D LE_FLOWCTL_MAX_CREDITS - chan->tx_credits; =09if (credits > max_credits) { =09=09BT_ERR("LE credits overflow");