Linux bluetooth development
 help / color / mirror / Atom feed
From: "Andrei A. Bykov" <andreiab9019@gmail.com>
To: linux-bluetooth@vger.kernel.org
Cc: marcel@holtmann.org, luiz.dentz@gmail.com, linux-kernel@vger.kernel.org
Subject: [PATCH v2 0/2] Bluetooth: fix bonded LE peripheral reconnect completion and holds
Date: Tue, 24 Nov 2026 11:09:54 -0300	[thread overview]
Message-ID: <20261124140956.15296-1-andreiab9019@gmail.com> (raw)

This series fixes two interactions seen when reconnecting a bonded Windows
central to an LE HID peripheral on an Intel AX210 with BlueZ 5.88.

The first patch preserves a synchronous terminal-event waiter across an
unrelated command reply and refreshes that waiter for the next synchronous
command after timeout or cancellation. The second keeps LE discovery hold
ownership in its completion callback and handles both encryption and key
refresh setup paths, including failed setup followed by a late event.

Changes since v1, following the public Sashiko report:
- Refresh the saved request from a callback-bearing synchronous command,
  including after timeout or cancellation; retain Reset resend ownership.
- Handle the BT_CONFIG key-refresh path through hci_encrypt_cfm().
- Explicitly abort failed LE setup and prevent later feature events from
  announcing that aborting connection as successfully connected.
- Rebase onto the official Bluetooth master at 4fe38719e673, rather than
  the GitHub workflow branch used for v1.

Local extracted-function tests pass 152 dispatch and 62 lifetime checks
with GCC, Clang and ASan/UBSan. Both the unpatched tree and v1 fail the
new regression cases. These checks model kernel services and do not
exercise concurrent workqueues or a physical controller.

A full kernel and modules build of this revision on the official base
completed successfully; that upstream build was not boot-tested.

I also tested a backport to Linux 7.3.5 with the same configuration used
for v1 and upstream prerequisite f3183d7ad101 (Bluetooth: hci_sync: Drop
the command's sk reference), already present in the series base. Repeated
bonded reconnects, approximately seven hours without observed connection
loss, and disabling/re-enabling Bluetooth on Windows passed.

A hardware trace confirms encryption can complete before remote features
without prematurely completing the feature waiter. The short HID test
sent 48 reports. In a teardown run with 20 seconds of post-exit recording,
Disconnection Complete arrived 137 ms after Disconnect, with no observed
command or connection timeout. One earlier teardown wait of about two
seconds was not reproduced; its cause and relation to this series remain
unconfirmed.

Windows suspend/resume remains a limitation: in two attempts BlueZ
reported a connection while the test HID application continued waiting
for the notification subscription. I have not localized this to the peer,
BlueZ, the application or the kernel; this series does not claim to
resolve that scenario.

OpenAI Codex assisted with the analysis, patch preparation and tests.
Sashiko supplied the review findings addressed by this revision.

v1: https://lore.kernel.org/r/20261121033104.441146-1-andreiab9019@gmail.com
Review: https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261121033104.441146-1-andreiab9019%40gmail.com

Andrei A. Bykov (2):
  Bluetooth: hci_sync: keep unrelated replies away from event waiters
  Bluetooth: hci_core: preserve LE feature holds across encryption
    events

 include/net/bluetooth/hci_core.h |  9 +++++++-
 net/bluetooth/hci_core.c         | 16 +++++++++++++-
 net/bluetooth/hci_event.c        | 36 +++++++++++++++++++++++++-------
 3 files changed, 52 insertions(+), 9 deletions(-)


base-commit: 4fe38719e6738feaa90486e36b0790dd5d960a96
-- 
2.56.1


             reply	other threads:[~2026-11-24 14:10 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-24 14:09 Andrei A. Bykov [this message]
2026-11-24 14:09 ` [PATCH v2 1/2] Bluetooth: hci_sync: keep unrelated replies away from event waiters Andrei A. Bykov
2026-11-24 14:09 ` [PATCH v2 2/2] Bluetooth: hci_core: preserve LE feature holds across encryption events Andrei A. Bykov

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=20261124140956.15296-1-andreiab9019@gmail.com \
    --to=andreiab9019@gmail.com \
    --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