From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=185.70.43.22 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796262926; b=2d/YczplNT6a+r79N0pc5nHtl1wYtSwvMaU3ltButXNeu/gwejxLqlgLNBCgYEbJrE9z LF7YWkU1PeLwTA7YHRJnutCjb7BLSxvdaQ/aOS+HN9zZDNi5/NF+qRwNtjoV/Xo8wnx6s SOWj6/dXV2GThC4h/lByWbHU8ZZblFDFwM31+R/56yuUYzmmTUqAT3EIs3qlhoaIW52BM ucZrfZsuNMPBACSeWHCYE1gmRx8UKxZB/MWmTbq91ahZSP72cNLjUsq5wbyG3KRbR31bv t0ID//dZsGxi3c1kB97tGT424P+MSCFhz5WPdMLdxkJc/IzOJEnb6fD1JV/zZOGoNzA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796262926; h=DMARC-Filter:DKIM-Signature:Date:To:From:Cc:Subject:Message-ID: In-Reply-To:References:Feedback-ID:X-Pm-Message-ID:MIME-Version: Content-Type:Content-Transfer-Encoding; bh=5BK5X//3KeTwoRje4EV8sU8peoovgAbrsRIl7DDJYYU=; b=Jflmsj+UOlOaZxdN8FmwK9KDgMc4ggFbW9uAvemjj0wZoYU8y5beUx++Hlqmbv8E7X43 eV1EafrZBzKbAA+Fcbwg2lIye5ajiB7UJZa2xx7Kj543NBnAXvgK79/1JNSDQ8IqdXu98 VI/gB3pWvD6RmX8h6F9VsvAd1alIC150EsnZ3IfMvDqApN/Omc7x7o9t/Vkw4Cs4wKjQk RLLIF9Wv+HoK2Cnk0xsjsvCrfIRW4+7GDo+cHDf5hwMfiUM47eDIdhm75p+dA8eF7qTpx bxQi9M1x/94N69mXg0cyl+NeBMR5GiNZxeUIRix3hUDUh+xxbnkgsq6OljrVzxFeaJA== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=proton.me; spf=pass smtp.mailfrom=proton.me; dkim=pass header.d=proton.me header.i=@proton.me header.a=rsa-sha256 header.s=protonmail2 header.b=E3DiMj4+; arc=none smtp.remote-ip=185.70.43.22 Received: from mail-4322.protonmail.ch (mail-4322.protonmail.ch [185.70.43.22]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3E9D7606A334 for ; Thu, 3 Dec 2026 01:55:21 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 3E9D7606A334 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=proton.me Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=proton.me Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key, unprotected) header.d=proton.me header.i=@proton.me header.a=rsa-sha256 header.s=protonmail2 header.b=E3DiMj4+ DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=proton.me; s=protonmail2; t=1796262919; x=1796522119; bh=5BK5X//3KeTwoRje4EV8sU8peoovgAbrsRIl7DDJYYU=; h=Date:To:From:Cc:Subject:Message-ID:In-Reply-To:References: Feedback-ID:From:To:Cc:Date:Subject:Reply-To:Feedback-ID: Message-ID:BIMI-Selector; b=E3DiMj4+inomSNvwQ9UufXRal8RtL0flI54/+BUGv1IYo0DwVE20lBwFBA4JQgBoF DDfeGl60b52sadOqo1t2gkxM7UBVoW5Yw/WCXiS8JQ3F8Ss2eZOn4vnebqrXdUO7Bu jUxu7yDmfzLhEJkmjJU7R1R9R2xZoqy/gdGCwWxcW1rCn+Q7veJOFOcDAO58ng7aZ7 M+W9vqLqxMITG91lLSVKuHkZelk+0lj/f2fU63PBqqHUq3OYUvyBsjiTHcpx7ypzRO 46xoPRT46jEMSMYa7ENAZhi/Xj2wq0fcWLJKOa16rxOBRRj2gHVsV1yPFDR9p0aldZ nUGeDGkWo3zEw== Date: Thu, 03 Dec 2026 01:55:15 +0000 To: linux-bluetooth@vger.kernel.org From: Kyle Pepper Cc: marcel@holtmann.org, luiz.dentz@gmail.com Subject: [RFC PATCH v2 1/2] Bluetooth: Match LE connection update completions Message-ID: <20261203015454.3566161-2-cochcoder@proton.me> In-Reply-To: <20261203015454.3566161-1-cochcoder@proton.me> References: <20261203015454.3566161-1-cochcoder@proton.me> Feedback-ID: 97716137:user:proton X-Pm-Message-ID: 93c39f0aba06559160a47002880be4efe30aa9de X-Mailing-List: linux-bluetooth@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable 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 --- 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@p= roton.me/ Offline validation: four W=3D1 objects; GCC/Clang source-extracted LE dispa= tch 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 suppo= rt. 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 @@ =09 (hci_opcode_ogf(hci_skb_opcode(hdev->req_skb)) =3D=3D 0x08 || =09 hci_skb_opcode(hdev->req_skb) =3D=3D HCI_OP_NOP) && =09 hci_skb_event(hdev->req_skb) =3D=3D ev->subevent) { +=09=09if (hci_skb_opcode(hdev->req_skb) =3D=3D HCI_OP_LE_CONN_UPDATE) { +=09=09=09struct hci_cp_le_conn_update *cp; +=09=09=09struct hci_ev_le_conn_update_complete *complete; + +=09=09=09if (hdev->req_skb->len < HCI_COMMAND_HDR_SIZE + +=09=09=09=09=09=09=09 sizeof(*cp) || +=09=09=09 skb->len < sizeof(*complete)) +=09=09=09=09goto dispatch; + +=09=09=09cp =3D (void *)(hdev->req_skb->data + HCI_COMMAND_HDR_SIZE); +=09=09=09complete =3D (void *)skb->data; +=09=09=09if (cp->handle !=3D complete->handle) +=09=09=09=09goto dispatch; + +=09=09=09*status =3D complete->status; +=09=09} + =09=09*opcode =3D hci_skb_opcode(hdev->req_skb); -=09=09hci_req_cmd_complete(hdev, *opcode, 0x00, req_complete, +=09=09hci_req_cmd_complete(hdev, *opcode, *status, req_complete, =09=09=09=09 req_complete_skb); =09} =20 +dispatch: =09subev =3D &hci_le_ev_table[ev->subevent]; =09if (!subev->func) =09=09return;