Linux bluetooth development
 help / color / mirror / Atom feed
From: Kyle Pepper <cochcoder@proton.me>
To: linux-bluetooth@vger.kernel.org
Cc: luiz.dentz@gmail.com, marcel@holtmann.org
Subject: [PATCH v17] Bluetooth: L2CAP: Restrict LE credits to connected CoCs
Date: Thu, 03 Dec 2026 18:34:00 +0000	[thread overview]
Message-ID: <20261203183345.111691-1-cochcoder@proton.me> (raw)
In-Reply-To: <20261201022855.1483888-1-cochcoder@proton.me>

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 <cochcoder@proton.me>
---
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=1 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,
 
 	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");


  parent reply	other threads:[~2026-12-03 18:34 UTC|newest]

Thread overview: 25+ 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           ` [PATCH v16 1/2] " Kyle Pepper
2026-12-01  6:54             ` [v16,1/2] " bluez.test.bot
2026-12-03 16:23             ` [PATCH v16 1/2] " cochcoder
2026-12-03 16:31               ` Luiz Augusto von Dentz
2026-12-03 18:34             ` Kyle Pepper [this message]
2026-12-03 18:38               ` [PATCH v17] " Luiz Augusto von Dentz
2026-12-03 18:52                 ` cochcoder
2026-12-04  2:08               ` [v17] " 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=20261203183345.111691-1-cochcoder@proton.me \
    --to=cochcoder@proton.me \
    --cc=linux-bluetooth@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox