From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=185.70.43.16 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1795997163; b=2hJmbqgGrovVN2OsE2lwjujvXkQ73Jmdd0ii5y+CUY6+s2WWZA3jGM31ehOwlc3LNkVx 7hoPONUEtRG4n/O/HmYs1z083WBaaghQN1X00TxI+GX5pbQ73l49ulwgUntkBBRFnbMJi Mc/MN+CPYLuws1GAsnOpqE99Ri1EnbYOMMaTIzC/bX7N7OHydolUpBmJ3LDmoHX+a6a1A 5elpey1tbRJNmKiAPvhsZDs/Srb/hKebduRjQ2Lkhx8WirL1/hafjz9ufEa/6CSkNIrK/ Eo+GGYZmYqwEdY4DRFlSdWRNbppVMkW89HxVNJY53sFU4cOLBYwQGP1qUMdVzoUfTwA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795997163; 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=wI/nphfChqFUfcgQe6yg9VfO7wQXOstkZz/X52582kw=; b=FvVfO8HabMi06AmgcqXmTIJswfLwJmfjhUJlsFhQpQ1jJsfeyIjTRESe4he2x9JFNKVz f6dB2CQHYSz4gsQmo4ozQcoVGx+x3tE6QdPpwXO080cphoA3UEZjE4/2JFzTClnYcnXKK B2Vms0fgu22tTQ/BfyqvsrxrZDbM22svgIG+umLhXoxEqVBdUvJQvb6ArA65xr/F9nu7u 5ZbvVjfQKvuCjECkfydzlpzTpV9pe+i/QGNdrBqF9CE2j4Yc5X4CKIMZ2Xvysr4BDjY1F qqRmzxy2itCpAo2IcYjAlYbk3Laz2osselKxJxxntqNcaV+51kRG2Oc27ff9k7oJ5fQ== 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=k4s2C99j; arc=none smtp.remote-ip=185.70.43.16 Received: from mail-4316.protonmail.ch (mail-4316.protonmail.ch [185.70.43.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 A5725606A31C for ; Mon, 30 Nov 2026 00:06:02 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org A5725606A31C 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=k4s2C99j DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=proton.me; s=protonmail2; t=1795997160; x=1796256360; bh=wI/nphfChqFUfcgQe6yg9VfO7wQXOstkZz/X52582kw=; 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=k4s2C99jeR0LclrTZ58AbZTwaMKDP8+dYpJBIj8XTltw0wkVk0KejF/pim4WiJgrb xzr/ea1lvdK1qGeF9NYUglpM5CAVA01feAfDj2+oyHrGJpBEXcoJr05PuvFfUdz1ol qUCyXYdr7/KlXoG6CJVP7GgQgy4fkDpdF5p+XxwIkD5FZn93es2HY+dldyBteYwIRC ay4err+1xgAu/4xGsAvQDJ9lCQPg5ifLzTgNN1ZQElv4P61nB+wmomnlcYSefk66sP eS9g+KHYKIcm/pd3mZZ4y5Fgn4eLXL4ZhA/yNyXa4IcLNZBdILZXciqnGY6jcZqcSm MQJS6ZrrEHCDQ== Date: Mon, 30 Nov 2026 00:05:55 +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 v15 1/2] Bluetooth: L2CAP: Restrict LE credits to connected CoCs Message-ID: <6aff9cb5ebb1f1512734d5ecdac876a2cc0c86bc.1795807576.git.github.filter194@slmail.me> In-Reply-To: <6aff9cb5ebb1f1512734d5ecdac876a2cc0c86bc.1795650070.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> Feedback-ID: 97716137:user:proton X-Pm-Message-ID: e302355b56b7776a2b509177fbbfdb08b3b89e60 X-Mailing-List: linux-kernel@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 validation at mail preparation: - GCC/Clang sanitizer models: 134 expected outcomes, plus two preceding-source comparisons. - GCC/Clang/ECRED-off W=3D1 objects, sparse and strict CheckPatch pass. Smatch retains two inherited v14 diagnostics. - KCSAN and KASAN guest reruns use a separate workqueue prerequisite: work_static() reads work->data through atomic_long_read(). This fixes the preserved strict KCSAN report against queue_work_on(). The prerequisite is outside this two-patch Bluetooth series; the four reviewed Bluetooth files match the submitted source hashes. - KCSAN focused: 16/16; no kernel alerts. - KCSAN full: 138/142; no kernel alerts. All remaining failures match prese= rved v14 failures. One prior timeout now passes. - KASAN focused: 16/16; no kernel alerts. - KASAN full: 137/142; no kernel alerts. All remaining failures match prese= rved v14 failures. The private tester waits for old-channel failure dispatch before requiring a new request to succeed. The earlier premature-admission test is preserved= . The isolated checks ran alongside a kernel package build while its exclusive trial lock excluded hardware capture; they did not acquire that lock or delay the package install handoff. Lock protection was checked throughout. The original exact-match comparison rejected the improved KCSAN case; its raw FAIL record remains preserved. Strict KCSAN, weak-memory checks, lockdep and panic-on-warning remain active. The unmodified base still has the preserved KCSAN failure. Full validation remains incomplete. No v15 remote CI or hardware/PTS result is claimed. Inherited suite failures and Smatch findings remain. Changes in v15: - Keep a security upgrade pending while SMP key distribution runs; complete or fail it when pairing ends (new l2cap_security_recheck()). - Treat a latched SMP failure as failing every pending CoC upgrade before the work item marks them. - Consume the ECONNREFUSED returned to a deferred reader so it is not reported twice. - Reject BT_RCVMTU reconfiguration with EBUSY while a deferred ECRED response is unsent. - Restore shared-link pending security and MIC requirements after the last pending upgrade, preserving achieved and surviving requirements; revisit restoration on encryption-only confirmations too. - Acquire every distinct sibling's nested lock before batch completion; only the channel already locked by the caller skips acquisition (H1). - Consume the whole rejected batch before teardown callbacks can revisit another member and send a duplicate response (H2). - Patch 1's code and commit message are unchanged; only its mail version and series revision notes change. Previous v14 (no cover letter): https://lore.kernel.org/linux-bluetooth/6aff9cb5ebb1f1512734d5ecdac876a2cc0= c86bc.1795650070.git.github.filter194@slmail.me/ Previous patch 2: https://lore.kernel.org/linux-bluetooth/fc7072a78de49b72d9034349512983d95be= 4ba1a.1795650070.git.github.filter194@slmail.me/ V15 remote CI has not been run or verified. Local validation and limits are recorded separately; these unsigned exports require human review and DCO certification before sending. 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 943effc867402e232d4d4c4a93d4b7ba5d376367..8229bddca5df761dd1359b88752= e3d5f6d6090cf 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: f57f78086ab54f3b3122fbaeba2c842ba7bb6d00