Skip to content

Bluetooth: fix bonded LE peripheral reconnect completion and holds

Andrei A. Bykov linux-bluetooth lkml 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest2 patches 1 replyIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2Bluetooth: hci_event: keep event waiters pending on unrelated repliesnet/bluetooth/hci_event.c+26 -01 reply
2/2Bluetooth: hci_core: keep the LE feature hold until completioninclude/net/bluetooth/hci_core.h+3 -10 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 0/2] Bluetooth: fix bonded LE peripheral reconnect completion and holds

These patches fix two consecutive failures observed when a Windows central reconnects to a Linux LE HID peripheral using an existing bond.

Patch 1 prevents an asynchronous command reply from completing a different synchronous request that is still waiting for its terminal event. Once that is fixed, patch 2 prevents encryption confirmation from consuming the hold owned by asynchronous LE feature discovery.

The series is based on bluetooth-next:
029d11a1a6e4c414eb87ed965ed6bc09f36322ee
Both patches also apply to mainline:
5f22fb20497f4983094131f00a734362300d22d2

I tested the series on Linux 7.3.5 built from kernel.org sources and on the Arch Linux ZEN variant, using an Intel AX210 peripheral and BlueZ 5.88. On ZEN, I observed successful operation during a session whose process duration was 3h13m11s. I also tested application restart, Windows Bluetooth off/on, Windows suspend/resume, and concurrent physical mouse and Bluetooth audio use on ZEN; these scenarios worked successfully.

On the kernel.org stable build with this series applied, repeated application restarts also reconnected successfully. An HCI/ftrace capture confirmed that feature completion leaves the ATT hold at one and that explicit test teardown releases the last hold. The same capture contains 48 outgoing ATT test notifications.

On selected files from the stated bluetooth-next base, extracted-function checks pass 121 dispatcher and 30 lifetime assertions with GCC and Clang, including an ASan/UBSan run. Unpatched negative controls fail 13 dispatcher assertions and 20 lifetime assertions. Dependencies are modeled; these checks do not replace a full-kernel concurrency test. Full kernels were built and booted for 7.3.5. A full GCC build of the stated bluetooth-next base with both patches also completed successfully (kernel and modules, including Rust and Bluetooth module BTF), using a configuration derived from the running kernel.org stable 7.3.5 build. That upstream build has not been installed or booted.

Separate unresolved observation: after suspending the Linux peripheral, the application and bond survive, but advertising is not re-enabled in the captured interval. Restarting the application re-enables advertising and permits reconnection. Its relationship to these patches has not been established. This series does not claim to fix suspend/resume.

OpenAI Codex was used to assist with the analysis, patch preparation and tests. No raw radio captures or pairing keys are attached. A sanitized trace summary is available separately.

Andrei A. Bykov

---
Andrei A. Bykov (2):
Bluetooth: hci_event: keep event waiters pending on unrelated replies
Bluetooth: hci_core: keep the LE feature hold until completion

 include/net/bluetooth/hci_core.h |  4 +++-
 net/bluetooth/hci_event.c        | 26 ++++++++++++++++++++++++++
 2 files changed, 29 insertions(+), 1 deletion(-)

base-commit: 029d11a1a6e4c414eb87ed965ed6bc09f36322ee