From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=79.135.106.30 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796092169; b=hu+YafIlwloIVUoJ7lJCuaAx5RLTZ06BtawK/Q/pHxRCF3XXpyLzPocYc7fgR3PWrPG9 xxZgaDnRGKkKyYzfJcU+pW5bz794xEwLW9hGtGmN/ptLuw6ZKQjSdVXJ41goqHhDG7niP FsQ99zKHH5pI1fiuZmwJFbuPJemDAWxTq1wcNog6l8udh/aW/PqWpJF60YFCzSUuJdHsq nTZ35uXhcmHeKV+aROMqKKsGUGsgJv2A7uLqNl2aKKk/3hBjIjNY2ChQ7RLvpJHVO+4LU XF7dHPNn+A3ltPp2nw55KE4XBNhyWdXRcWQ0JIPS2aC3VeahmgAjQUmK74XAFfdhy1A== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796092169; 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=6uHCyC1OI6ISsXeYQkUg4UT+UJ55K7POrdeFn9COimY=; b=32L7yNjR/WOGhdXPm+LlF7MwTLNdjeNwg7c3gQIf7YM6r0gcJORTYVnZCDriqZbsJARB +hi8gnum22wp2stmSxwSDpnBWlBLjTKmA6iGwMp5OrV6zSXcB6kXJ1YwsoenIEyG0QtMp JZf5rk0kbzWsVnUXYv76r6QgCZCWeE4Jmvwq8wHptZIiFk42fEOgLEKDThT8U10QeDcz6 IcRbN/x8ectruziuKMGdeqeZWboCRGxQhJjJypjRlaH7jMFKGBVngZAQpeypd7J3GMHCB nO4gErRHkC3P5OqHyep0FkrKYcMuQsg1lWRuOQoEx+9qqKvXtvrVDtbME2ZJVn5ZEWQ== 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=BrtLQUur; arc=none smtp.remote-ip=79.135.106.30 Received: from mail-10630.protonmail.ch (mail-10630.protonmail.ch [79.135.106.30]) (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 67B5C606A31A for ; Tue, 1 Dec 2026 02:29:28 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 67B5C606A31A 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=BrtLQUur DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=proton.me; s=protonmail2; t=1796092166; x=1796351366; bh=6uHCyC1OI6ISsXeYQkUg4UT+UJ55K7POrdeFn9COimY=; 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=BrtLQUur482ymjSkwxQF0HtCcVdkiSpUsx1OZ+f0rEQKiTGtImE0HsBCEzKMmGNLo nqJ/08XhZb0lStCSM9FQep4qe+o/bU40yIFozu76JIfHWWmWRhN8OHSVUTBfiXpCPJ ImMYXbWXvGl2SPG1szPgAaiNxzDfEsft4MO3uQ4P0V4AJlc5D4G9ejTVIESSBVpkgd k82ef8TFkT8i3FY7ZcBRU3td/FbZBdmwv5FL0pDHFYM3B1Yc+z2stqVGi63G+cIr/j uuYFt1twF87Sf1tb9P3IUC1frQNSDezEpK1SBL4Ff8XKVB47pyrUPFkMpHS4ClYjUQ s65fh32H+yYtA== Date: Tue, 01 Dec 2026 02:29:21 +0000 To: linux-bluetooth@vger.kernel.org From: Kyle Pepper Cc: luiz.dentz@gmail.com, marcel@holtmann.org, linux-kernel@vger.kernel.org Subject: [PATCH v16 1/2] Bluetooth: L2CAP: Restrict LE credits to connected CoCs Message-ID: <20261201022855.1483888-1-cochcoder@proton.me> In-Reply-To: <6aff9cb5ebb1f1512734d5ecdac876a2cc0c86bc.1795807576.git.github.filter194@slmail.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> Feedback-ID: 97716137:user:proton X-Pm-Message-ID: bc6f36d087ff9b99243ce2870ee548d1cef361b5 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 Do not let credit indications change fixed channels or complete pending connection setup. Validate the channel state and mode before accounting credits, checking overflow or invoking its resume callback. AI assistance: Codex prepared this attribution revision and assisted with validation and commit text. Earlier revisions disclosed LLM assistance for the credit-state guard. Fixes: fad5fc89594d ("Bluetooth: Add LE flow control discipline") Signed-off-by: Kyle Pepper --- Local v16 validation (unsigned review only): - GCC/Clang ASan/UBSan: 172 expected outcomes, including 50 mutation controls. - GCC/Clang/ECRED-off W=3D1 objects and sparse pass. - Smatch retains two inherited diagnostics. - KASAN: focused 16/16; full 137/142, with all five failures matching the preserved v14 baseline and no kernel alerts. - Strict KCSAN: 16/16 focused on the initial two images. First full run panicked in move_linked_works / queue_work_on. The control panicked in process_one_work / queue_work_on. The second control passed 16/16 focused; its full run panicked in skb_queue_tail / vhci_poll [hci_vhci]. The sanitizer guests use separate test-only workqueue changes. No v16 remote CI, hardware or PTS result is claimed. Changes in v16: - Return EBUSY from BT_SECURITY until a latched SMP result, queued confirmation or link requirement restore has been dispatched. - Return a deferred ECRED rejection from BT_SECURITY completion and consume teardown's duplicate socket error. - Answer the whole deferred ECRED batch when the peer disconnects one child, so an accepted sibling is not left without a response. - Count accepted-but-unanswered children when rejecting a reused ECRED identifier. - Wrap validation notes to fix the v15 GitLint B1 failures in PR1250. https://github.com/bluez/bluetooth-next/pull/1250 - Rebase onto current bluetooth-next, preserving upstream ECRED key-size validation and the MPS-adjustment removal. Previous v15: https://lore.kernel.org/linux-bluetooth/6aff9cb5ebb1f1512734d= 5ecdac876a2cc0c86bc.1795807576.git.github.filter194@slmail.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 index b8c85c478..6ee19d98f 100644 --- a/net/bluetooth/l2cap_core.c +++ b/net/bluetooth/l2cap_core.c @@ -5469,6 +5469,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"); base-commit: e0e943a9dbcd7675652e2900d09e8595f28f724e