All of lore.kernel.org
 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
Subject: [RFC PATCH v2 1/2] Bluetooth: Match LE connection update completions
Date: Thu, 03 Dec 2026 01:55:15 +0000	[thread overview]
Message-ID: <20261203015454.3566161-2-cochcoder@proton.me> (raw)
In-Reply-To: <20261203015454.3566161-1-cochcoder@proton.me>

LE meta dispatch completes synchronous connection updates on the
subevent alone and supplies success without checking the event status.
An update for another handle, or a failed or truncated update, can release
the wait as successful.

Match the requested connection handle and require the complete event body
before completing the request. Propagate its status while still dispatching
unrelated link updates to their normal handler.

AI assistance: Codex (GPT-6).

Signed-off-by: Kyle Pepper <cochcoder@proton.me>
---
Base: bluetooth-next 7a1a7a5baa1e0f84d0568fc999421ee7dcbccaf5.
Previous version (human-reported):
https://lore.kernel.org/linux-bluetooth/20261202235608.3238527-1-cochcoder@proton.me/

BlueZ companion, already archived:
https://lore.kernel.org/linux-bluetooth/20261202160403.226082-1-cochcoder@proton.me/

Offline validation: four W=1 objects; GCC/Clang source-extracted LE dispatch
and CE queue tests; getter lengths 0..16 and baseline/negative controls.
The exact source has no hardware, PTS or running-kernel lockdep result.
Older integrated N8/MT7922 trials do not establish general controller support.

diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c
--- a/net/bluetooth/hci_event.c
+++ b/net/bluetooth/hci_event.c
@@ -8494,11 +8494,29 @@
 	   (hci_opcode_ogf(hci_skb_opcode(hdev->req_skb)) == 0x08 ||
 	    hci_skb_opcode(hdev->req_skb) == HCI_OP_NOP) &&
 	    hci_skb_event(hdev->req_skb) == ev->subevent) {
+		if (hci_skb_opcode(hdev->req_skb) == HCI_OP_LE_CONN_UPDATE) {
+			struct hci_cp_le_conn_update *cp;
+			struct hci_ev_le_conn_update_complete *complete;
+
+			if (hdev->req_skb->len < HCI_COMMAND_HDR_SIZE +
+							 sizeof(*cp) ||
+			    skb->len < sizeof(*complete))
+				goto dispatch;
+
+			cp = (void *)(hdev->req_skb->data + HCI_COMMAND_HDR_SIZE);
+			complete = (void *)skb->data;
+			if (cp->handle != complete->handle)
+				goto dispatch;
+
+			*status = complete->status;
+		}
+
 		*opcode = hci_skb_opcode(hdev->req_skb);
-		hci_req_cmd_complete(hdev, *opcode, 0x00, req_complete,
+		hci_req_cmd_complete(hdev, *opcode, *status, req_complete,
 				     req_complete_skb);
 	}
 
+dispatch:
 	subev = &hci_le_ev_table[ev->subevent];
 	if (!subev->func)
 		return;


  reply	other threads:[~2026-12-03  1:55 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-03  1:55 [RFC PATCH v2 0/2] Bluetooth: LE connection event length requests Kyle Pepper
2026-12-03  1:55 ` Kyle Pepper [this message]
2026-12-03  1:55 ` [RFC PATCH v2 2/2] Bluetooth: Add " 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=20261203015454.3566161-2-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 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.