mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Kyle Pepper <cochcoder@proton.me>
To: linux-bluetooth@vger.kernel.org
Cc: marcel@holtmann.org, luiz.dentz@gmail.com, linux-kernel@vger.kernel.org
Subject: [RFC PATCH v4] Bluetooth: l2cap: prefer compatible local LE intervals
Date: Tue, 24 Nov 2026 05:23:25 +0000	[thread overview]
Message-ID: <b6847b841127362e423b49f9e48118f97985865d.1795497229.git.cochcoder@proton.me> (raw)
In-Reply-To: <20261015181041.42873-1-cochcoder@proton.me>

Prefer the intersection of a valid peer interval range and local
preferences when they overlap. Otherwise retain the peer request
instead of treating an initial preference as a hard supported bound.

Validate the original request before narrowing its interval range.
Leave latency, timeout and disjoint-range acceptance unchanged.

Assisted-by: OpenCode:gpt-6.1-sol
Assisted-by: Codex:GPT-6
Signed-off-by: Kyle Pepper <cochcoder@proton.me>
---
Previous version: https://lore.kernel.org/r/20261015181041.42873-1-cochcoder@proton.me

Changes since v3:
- Drop redundant candidate revalidation on the corrected upstream
  product-based validator (c1d50a71cdee). Validate the original
  request first; retain disjoint fallback and peer latency/timeout.

The local range remains a preference, not a hard peer bound.

Validation:
- GCC/Clang ASan+UBSan: 397,723 source-extracted kernel parameter
  cases, framing/role and rejection controls; 310 tester callback controls.
- GCC/Clang W=1 kernel object builds; BlueZ GCC build and make check
  (35/35); ten interval cases register.
Fresh native interval/VM/controller runs are unavailable on this host.
The callback fixtures mock peer I/O and reporting; they do not replace
native integration testing. Remote CI and interoperability remain open.

The stock mail checker rejects the required Assisted-by tag format;
source-only checkpatch passes. Attribution is retained.

AI assistance: source review, test coverage, simplification and wording.

 net/bluetooth/l2cap_core.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c
index 943effc86..4f4625b97 100644
--- a/net/bluetooth/l2cap_core.c
+++ b/net/bluetooth/l2cap_core.c
@@ -5089,6 +5089,17 @@ static inline int l2cap_conn_param_update_req(struct l2cap_conn *conn,
 	memset(&rsp, 0, sizeof(rsp));
 
 	err = hci_check_conn_params(min, max, latency, to_multiplier);
+	if (!err) {
+		u16 pref_min = max_t(u16, min, hcon->le_conn_min_interval);
+		u16 pref_max = min_t(u16, max, hcon->le_conn_max_interval);
+
+		/* Local preferences must not reject a valid peer request. */
+		if (pref_min <= pref_max) {
+			min = pref_min;
+			max = pref_max;
+		}
+	}
+
 	if (err)
 		rsp.result = cpu_to_le16(L2CAP_CONN_PARAM_REJECTED);
 	else

base-commit: ffb95458a0f70dcab620eee0ecf5ef7750971b2f


      parent reply	other threads:[~2026-11-24  5:23 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-13  3:31 [RFC PATCH] Bluetooth: l2cap: honor local LE connection interval range Kyle Pepper
2026-10-13 14:33 ` Luiz Augusto von Dentz
2026-10-15 18:12   ` cochcoder
2026-10-15  4:34 ` [RFC PATCH v2] Bluetooth: l2cap: prefer compatible local LE intervals Kyle Pepper
2026-10-15 18:11   ` [RFC PATCH v3] " Kyle Pepper
2026-10-31 18:09     ` cochcoder
2026-11-24  5:23     ` Kyle Pepper [this message]

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=b6847b841127362e423b49f9e48118f97985865d.1795497229.git.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®