Linux bluetooth development
 help / color / mirror / Atom feed
* [PATCH] Bluetooth: hci_conn: Terminate a PA sync while other PA syncs are open
@ 2026-11-22 20:13 Simon Mikuda
  2026-11-22 22:45 ` bluez.test.bot
  0 siblings, 1 reply; 2+ messages in thread
From: Simon Mikuda @ 2026-11-22 20:13 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Simon Mikuda, Marcel Holtmann, Luiz Augusto von Dentz

hci_le_big_terminate() keeps a PA sync while another connection with
HCI_CONN_PA_SYNC has the same BIG. The PA syncs a scan makes to read each
BASE all have the same unset BIG, so one closed while another is open is
never terminated:

    < LE Periodic Advertising Create Sync  50:1E:2D:9E:E7:92
    > LE Periodic Advertising Sync Established  Sync handle: 40
    < LE Periodic Advertising Create Sync  5C:B4:7E:26:20:81
    > LE Periodic Advertising Sync Established  Sync handle: 41
      (both sync sockets closed)
    < LE Periodic Advertising Terminate Sync  Sync handle: 0x0029

A later join to the first broadcaster then fails and the BIG sync never
starts:

    < LE Periodic Advertising Create Sync  50:1E:2D:9E:E7:92
    > Command Status  ACL Connection Already Exists (0x0b)

    bluetoothd: iso_do_big_sync() bt_io_bcast_accept: bind: File
    descriptor in bad state (77)

Count only the connections of the same BIG that have the same sync handle.

Fixes: fcb89f120376 ("Bluetooth: ISO: Fix bcast listener cleanup")
Signed-off-by: Simon Mikuda <simon.mikuda@streamunlimited.com>
---
 net/bluetooth/hci_conn.c | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/net/bluetooth/hci_conn.c b/net/bluetooth/hci_conn.c
index 2fb37e078d73..0cbb96d3f961 100644
--- a/net/bluetooth/hci_conn.c
+++ b/net/bluetooth/hci_conn.c
@@ -857,6 +857,18 @@ static void find_bis(struct hci_conn *conn, void *data)
 	d->count++;
 }
 
+static void find_pa_sync(struct hci_conn *conn, void *data)
+{
+	struct iso_list_data *d = data;
+
+	/* Ignore if BIG or PA sync doesn't match */
+	if (d->big != conn->iso_qos.bcast.big ||
+	    d->sync_handle != conn->sync_handle)
+		return;
+
+	d->count++;
+}
+
 static int hci_le_big_terminate(struct hci_dev *hdev, struct hci_conn *conn)
 {
 	struct iso_list_data *d;
@@ -874,7 +886,7 @@ static int hci_le_big_terminate(struct hci_dev *hdev, struct hci_conn *conn)
 
 	if (conn->type == PA_LINK &&
 	    test_and_clear_bit(HCI_CONN_PA_SYNC, conn->flags)) {
-		hci_conn_hash_list_flag(hdev, find_bis, PA_LINK,
+		hci_conn_hash_list_flag(hdev, find_pa_sync, PA_LINK,
 					HCI_CONN_PA_SYNC, d);
 
 		if (!d->count)

base-commit: 4fe38719e6738feaa90486e36b0790dd5d960a96
-- 
2.43.0


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

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

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-22 20:13 [PATCH] Bluetooth: hci_conn: Terminate a PA sync while other PA syncs are open Simon Mikuda
2026-11-22 22:45 ` bluez.test.bot

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