From: Cen Zhang <zzzccc427@gmail.com>
To: marcel@holtmann.org, luiz.dentz@gmail.com
Cc: linux-bluetooth@vger.kernel.org, linux-kernel@vger.kernel.org,
baijiaju1990@gmail.com, jjzuming@gmail.com, zzzccc427@gmail.com
Subject: [PATCH v5 0/4] Bluetooth: SMP: Serialize root channel updates
Date: Thu, 19 Nov 2026 08:33:39 +0800 [thread overview]
Message-ID: <pm-bluetooth-objects-candidate-0184-v12-e80229724d6ad14ca88c-0@gmail.com> (raw)
SMP root changes must serialize with their users. Publish BT_LISTEN only
after the root is initialized, under the global channel list lock,
so another controller with the same address cannot select a
partially initialized root (patch 1).
The force_bredr_smp writer takes hdev->lock and changes only its flag
while the controller is down (patch 2). Power-on holds the request lock
for its auto-off update (patch 3). Registration then runs on the ordered
HCI workqueue under hdev->lock (patch 4), excluding both HCI event users
and SMP receive callbacks from root replacement. Patch 4 depends on
patch 3. Patch 2's exclusion from power-on also needs patch 4.
The old mgmt_powered() called smp_register() synchronously under the
device mutex before submitting the HCI update. It did not run in the
receive worker. SMP receive callbacks began using root-owned OOB data in
March 2015, before the synchronous HCI update conversion that November.
The shared root transform use was added in September 2018. Patch 4
corrects that history and tags the earlier root-data access as well.
The WARN_ON() for replacing an already registered root remains. The
separate HCI_CONFIG auto-off shortcut issue mentioned in the review
also predates this series and is outside these root lifetime changes.
Validation: GCC modular and Clang built-in Bluetooth builds, including
Clang context analysis; every prefix and the combined tree with the six
new Bluetooth series build successfully. No new kernel runtime test was
run; the quoted reports are from the earlier instrumented test kernels.
I used Codex (OpenAI) to help write these patches.
Cen Zhang (4):
Bluetooth: SMP: Publish root channels after initialization
Bluetooth: SMP: Serialize forced BR/EDR channel changes
Bluetooth: hci_core: Hold the request lock for the power-on update
Bluetooth: SMP: Serialize root channel replacement
include/net/bluetooth/l2cap.h | 1 +
net/bluetooth/hci_core.c | 3 +++
net/bluetooth/hci_debugfs.c | 2 ++
net/bluetooth/l2cap_core.c | 8 ++++++
net/bluetooth/smp.c | 46 ++++++++++++++++++++++++++++++++---
net/bluetooth/smp.h | 3 ++-
6 files changed, 59 insertions(+), 4 deletions(-)
---
Changes in v5:
- Move the AI assistance disclosure to plain text in the cover letter.
Changes in v4:
- Address the cross-controller root publication and powered-off debugfs
concerns raised by Sashiko:
https://netdev-ai.bots.linux.dev/sashiko/#/patchset/pm-bluetooth-objects-candidate-0184-v9-4094fa28af7bd56a283a-0%40gmail.com
- Publish fixed roots only after initialization under chan_list_lock, and
change only the force flag while HCI_UP is clear.
- Correct the registration history and early root-data Fixes reference;
state the dependency between debugfs and power-on serialization.
Changes in v3:
- Address the hci_power_on() path that reaches smp_register() without the
request lock, raised by Sashiko: https://sashiko.dev/#/patchset/99158
- Add patch 2, which takes the request lock in hci_power_on() again, and
correct the locking description of patch 3; the code of patches 1 and 3 is
unchanged.
Changes in v2:
- Address the CheckPatch and GitLint long-line failures reported by the
Bluetooth CI: https://patchwork.kernel.org/series/1197223/
- Trim the crash reports in both commit messages to the headline, call trace
and allocation/free stacks; no code changes.
Link to v1: https://lore.kernel.org/r/pm-bluetooth-objects-candidate-0184-v7-c26e53b52c260063ab6a-0@gmail.com
Link to v2: https://lore.kernel.org/r/pm-bluetooth-objects-candidate-0184-v8-60106ad0c49170f5bfb4-0@gmail.com
Link to v3: https://lore.kernel.org/r/pm-bluetooth-objects-candidate-0184-v9-4094fa28af7bd56a283a-0@gmail.com
Link to v4: https://lore.kernel.org/r/pm-bluetooth-objects-candidate-0184-v11-900043ed2303656c76fe-0@gmail.com
next reply other threads:[~2026-11-19 0:33 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-19 0:33 Cen Zhang [this message]
2026-11-19 0:33 ` [PATCH v5 1/4] Bluetooth: SMP: Publish root channels after initialization Cen Zhang
2026-11-19 0:33 ` [PATCH v5 2/4] Bluetooth: SMP: Serialize forced BR/EDR channel changes Cen Zhang
2026-11-19 0:33 ` [PATCH v5 3/4] Bluetooth: hci_core: Hold the request lock for the power-on update Cen Zhang
2026-11-19 0:33 ` [PATCH v5 4/4] Bluetooth: SMP: Serialize root channel replacement Cen Zhang
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=pm-bluetooth-objects-candidate-0184-v12-e80229724d6ad14ca88c-0@gmail.com \
--to=zzzccc427@gmail.com \
--cc=baijiaju1990@gmail.com \
--cc=jjzuming@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 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.