All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v5 0/4] Bluetooth: SMP: Serialize root channel updates
@ 2026-11-19  0:33 Cen Zhang
  2026-11-19  0:33 ` [PATCH v5 1/4] Bluetooth: SMP: Publish root channels after initialization Cen Zhang
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Cen Zhang @ 2026-11-19  0:33 UTC (permalink / raw)
  To: marcel, luiz.dentz
  Cc: linux-bluetooth, linux-kernel, baijiaju1990, jjzuming, zzzccc427

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-11-19  0:34 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-19  0:33 [PATCH v5 0/4] Bluetooth: SMP: Serialize root channel updates Cen Zhang
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

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.