[PATCH v4 0/4] Bluetooth: SMP: Serialize root channel updates
From: Cen Zhang
Date: Tue Nov 17 2026 - 23:21:58 EST
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.
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 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@xxxxxxxxx
Link to v2: https://lore.kernel.org/r/pm-bluetooth-objects-candidate-0184-v8-60106ad0c49170f5bfb4-0@xxxxxxxxx
Link to v3: https://lore.kernel.org/r/pm-bluetooth-objects-candidate-0184-v9-4094fa28af7bd56a283a-0@xxxxxxxxx