From: Kyle Pepper <cochcoder@proton.me>
To: linux-bluetooth@vger.kernel.org
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
Date: Tue, 01 Dec 2026 02:29:21 +0000 [thread overview]
Message-ID: <20261201022855.1483888-1-cochcoder@proton.me> (raw)
In-Reply-To: <6aff9cb5ebb1f1512734d5ecdac876a2cc0c86bc.1795807576.git.github.filter194@slmail.me>
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 <cochcoder@proton.me>
---
Local v16 validation (unsigned review only):
- GCC/Clang ASan/UBSan: 172 expected outcomes, including
50 mutation controls.
- GCC/Clang/ECRED-off W=1 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/6aff9cb5ebb1f1512734d5ecdac876a2cc0c86bc.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,
l2cap_chan_lock(chan);
+ if (chan->state != BT_CONNECTED ||
+ (chan->mode != L2CAP_MODE_LE_FLOWCTL &&
+ chan->mode != L2CAP_MODE_EXT_FLOWCTL))
+ goto unlock;
+
max_credits = LE_FLOWCTL_MAX_CREDITS - chan->tx_credits;
if (credits > max_credits) {
BT_ERR("LE credits overflow");
base-commit: e0e943a9dbcd7675652e2900d09e8595f28f724e
next prev parent reply other threads:[~2026-12-01 2:29 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-13 3:06 [PATCH v10 1/2] Bluetooth: L2CAP: Restrict LE credits to connected CoCs Kyle Pepper
2026-11-13 3:06 ` [PATCH v10 2/2] Bluetooth: L2CAP: Keep credits from completing security upgrades Kyle Pepper
2026-11-13 14:00 ` [PATCH v11 1/2] Bluetooth: L2CAP: Restrict LE credits to connected CoCs Kyle Pepper
2026-11-13 17:10 ` [v11,1/2] " bluez.test.bot
2026-11-14 6:05 ` [PATCH v12 1/2] " Kyle Pepper
2026-11-24 14:02 ` [PATCH v13 " Kyle Pepper
2026-11-24 18:48 ` [v13,1/2] " bluez.test.bot
2026-11-25 23:44 ` [PATCH v14 1/2] " Kyle Pepper
2026-11-26 3:40 ` [v14,1/2] " bluez.test.bot
2026-11-30 0:05 ` [PATCH v15 1/2] " Kyle Pepper
2026-11-30 5:03 ` [v15,1/2] " bluez.test.bot
2026-12-01 2:29 ` Kyle Pepper [this message]
2026-12-01 6:54 ` [v16,1/2] " bluez.test.bot
2026-12-01 2:29 ` [PATCH v16 2/2] Bluetooth: L2CAP: Keep credits from completing security upgrades Kyle Pepper
2026-11-30 0:06 ` [PATCH v15 " Kyle Pepper
2026-11-25 23:44 ` [PATCH v14 " Kyle Pepper
2026-11-24 14:02 ` [PATCH v13 " Kyle Pepper
2026-11-14 6:05 ` [PATCH v12 " Kyle Pepper
2026-11-13 14:00 ` [PATCH v11 " Kyle Pepper
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261201022855.1483888-1-cochcoder@proton.me \
--to=cochcoder@proton.me \
--cc=linux-bluetooth@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=luiz.dentz@gmail.com \
--cc=marcel@holtmann.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.