Skip to content

Bluetooth: ISO-related concurrency fixes

Pauli Virtanen linux-bluetooth 3 versions – Applied

Status from this message: This series was applied to bluetooth/bluetooth-next.git (master)

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v3 Latest3 patches 1 replyApplied 3/3
  2. v23 patches 7 repliesSuperseded
  3. v13 patches 4 repliesSuperseded

Changes in v3 from the cover letter

- Copy the pend_le_* lists, iterate over copy to make it simple.
- Rename to hci_pend_le_list_*

Patches in v3 All 3 applied

#Subject and filesSizeRepliesApplied
1/3Bluetooth: use RCU for hci_conn_params and iterate safely in hci_syncinclude/net/bluetooth/hci_core.h net/bluetooth/hci_conn.c net/bluetooth/hci_core.c +3 more+164 -441 replyApplied
2/3Bluetooth: hci_event: call disconnect callback before deleting connnet/bluetooth/hci_event.c+3 -00 repliesApplied
3/3Bluetooth: ISO: fix iso_conn related locking and validity issuesnet/bluetooth/iso.c+31 -220 repliesApplied

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v3 yet.

Read the v3 thread

Cover letter [PATCH v3 0/3] Bluetooth: ISO-related concurrency fixes

This series addresses some concurrency issues (NULL / GPF) in ISO sockets or related.

v3:
- Copy the pend_le_* lists, iterate over copy to make it simple.
- Rename to hci_pend_le_list_*

v2:
- Use RCU for the pend_le_* lists, avoid using hci_dev_lock.
- Always call disconn_cfm before hci_conn_del.

These were found while testing patches that make hci_le_set_cig_params check the validity of the configuration and return false if incorrect. This causes dropping of hci_conn just created, which apparently makes hitting race conditions easier.

The test setup was primitive

while true; do bluetoothctl power on; sleep 12; bluetoothctl power off; sleep 1.5; bluetoothctl power off; sleep 2.5; done; while true; do sudo systemctl restart bluetooth; sleep 110; done
while true; do systemctl --user restart pipewire wireplumber pipewire-pulse; sleep 91; done
while true; do paplay sample.flac & sleep 2; kill %1; sleep 0.7; done

and equivalent operations manually, on VM + connect to TWS earbuds. This eventually hit the NULL / GFP errors here, but they are hard to reproduce aside from the first one that appears in iso-tester.

Pauli Virtanen (3):
Bluetooth: use RCU for hci_conn_params and iterate safely in hci_sync
Bluetooth: hci_event: call disconnect callback before deleting conn
Bluetooth: ISO: fix iso_conn related locking and validity issues

 include/net/bluetooth/hci_core.h |   5 ++
 net/bluetooth/hci_conn.c         |  10 +--
 net/bluetooth/hci_core.c         |  38 ++++++++--
 net/bluetooth/hci_event.c        |  15 ++--
 net/bluetooth/hci_sync.c         | 117 ++++++++++++++++++++++++++++---
 net/bluetooth/iso.c              |  53 ++++++++------
 net/bluetooth/mgmt.c             |  26 +++----
 7 files changed, 198 insertions(+), 66 deletions(-)
Signature · 1 line
2.41.0