Linux bluetooth development
 help / color / mirror / Atom feed
* [PATCH bluetooth-next 0/2] Bluetooth: SMP: keep pairing keys private until pairing completes
@ 2026-11-27 21:19 Dickson Wu via B4 Relay
  2026-11-27 15:31 ` [PATCH bluetooth-next 1/2] Bluetooth: SMP: Defer IRK updates " Dickson Wu via B4 Relay
  2026-11-27 15:33 ` [PATCH bluetooth-next 2/2] Bluetooth: SMP: Keep pending LTKs private Dickson Wu via B4 Relay
  0 siblings, 2 replies; 4+ messages in thread
From: Dickson Wu via B4 Relay @ 2026-11-27 21:19 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Luiz Augusto von Dentz, Marcel Holtmann, Johan Hedberg

An incomplete pairing can share an IRK registry entry with another pairing,
then free it during teardown. CTKD can replace an LTK retained by an
incomplete LE pairing and free it from the BR/EDR pairing context. A second
LE link can retype a retained LTK as an STK that the LTK Request handler
frees. The series keeps received or generated keys private to each pairing
context and publishes registry updates only after pairing completes.

Tested under UML with KASAN and a VHCI controller, no radio, on
bluetooth-next f57f78086ab5 and mainline 9437ee8b6cf6 (patch 2 needed
context adjustment for mainline). Stock and explicitly reverted kernels
hit slab-use-after-free in list_del_rcu() from smp_chan_destroy() for all
three cases (shared IRK, CTKD LTK, second-link STK). With the series all
three pass, and so do normal LE LTK storage, CTKD derivation and storage,
LTK and IRK replacement on re-pairing, and RPA resolution. Patch 1 builds
on its own and net/bluetooth/ is W=1 clean. A reproducer is available if
it helps.

These need a peer whose Just Works pairing requests get accepted, so a
default bluetoothd with an agent does not accept them silently.

Patch 1 is near "Bluetooth: SMP: Use pairing data for IRK notifications"
on the list, which fixes a different Load IRKs race in the same IRK
notification code, so the two may need rebasing against each other.

This was found and the fix prepared with AI coding tools (OpenAI Codex
agents, with review by Claude). I went over the analysis and the patch
before signing off.

---
Dickson Wu (2):
      Bluetooth: SMP: Defer IRK updates until pairing completes
      Bluetooth: SMP: Keep pending LTKs private

 include/net/bluetooth/hci_core.h |  5 +++
 net/bluetooth/hci_core.c         | 76 +++++++++++++++++++++++++++++++---------
 net/bluetooth/hci_event.c        | 16 ++++++---
 net/bluetooth/smp.c              | 73 +++++++++++++++++++++++++-------------
 4 files changed, 125 insertions(+), 45 deletions(-)
---
base-commit: f57f78086ab54f3b3122fbaeba2c842ba7bb6d00
change-id: 20261127-bt-smp-n-880c682a5778

Best regards,
--  
Dickson Wu <dickson.wu@certik.com>



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

end of thread, other threads:[~2026-11-27 22:37 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-27 21:19 [PATCH bluetooth-next 0/2] Bluetooth: SMP: keep pairing keys private until pairing completes Dickson Wu via B4 Relay
2026-11-27 15:31 ` [PATCH bluetooth-next 1/2] Bluetooth: SMP: Defer IRK updates " Dickson Wu via B4 Relay
2026-11-27 22:37   ` Bluetooth: SMP: keep pairing keys private " bluez.test.bot
2026-11-27 15:33 ` [PATCH bluetooth-next 2/2] Bluetooth: SMP: Keep pending LTKs private Dickson Wu via B4 Relay

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox