[RFC PATCH v4] Bluetooth: l2cap: prefer compatible local LE intervals

From: Kyle Pepper

Date: Tue Nov 24 2026 - 00:23:42 EST


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@xxxxxxxxx>
---
Previous version: https://lore.kernel.org/r/20261015181041.42873-1-cochcoder@xxxxxxxxx

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