Skip to contentSkip to conversation

Bluetooth: hci_conn: Terminate a PA sync while other PA syncs are open

PATCH Applied Simon Mikuda 3 participants 3 messages Nov 22 – Nov 23

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Bluetooth: hci_conn: Terminate a PA sync while other PA syncs are open

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")
---
 net/bluetooth/hci_conn.c | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)
net/bluetooth/hci_conn.c +13 -1
index 2fb37e078d73..0cbb96d3f961 100644
@@ -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

Signature · 1 line
2.43.0
#1 lore raw

This is automated email and please do not reply to this email!

Dear submitter,

Thank you for submitting the patches to the linux bluetooth mailing list. This is a CI test results with your patch series:
PW Link:https://patchwork.kernel.org/series/1218950/

---Test result---

Test Summary:

CheckPatch                    PASS      0.55 seconds
VerifyFixes                   PASS      0.10 seconds
VerifySignedoff               PASS      0.10 seconds
GitLint                       PASS      0.26 seconds
SubjectPrefix                 PASS      0.10 seconds
BuildKernel                   PASS      19.10 seconds
CheckAllWarning               PASS      22.23 seconds
CheckSparse                   PASS      24.58 seconds
BuildKernel32                 PASS      20.58 seconds
CheckKernelLLVM               PASS      20.44 seconds
TestRunnerSetup               PASS      446.09 seconds
TestRunner_l2cap-tester       PASS      14.75 seconds
TestRunner_iso-tester         PASS      10.88 seconds
TestRunner_bnep-tester        PASS      2.85 seconds
TestRunner_mgmt-tester        PASS      83.24 seconds
TestRunner_rfcomm-tester      PASS      4.04 seconds
TestRunner_sco-tester         PASS      4.96 seconds
TestRunner_ioctl-tester       PASS      4.15 seconds
TestRunner_mesh-tester        PASS      4.08 seconds
TestRunner_smp-tester         PASS      4.00 seconds
TestRunner_userchan-tester    PASS      2.88 seconds
TestRunner_6lowpan-tester     PASS      4.08 seconds
IncrementalBuild              PASS      20.95 seconds

https://github.com/bluez/bluetooth-next/pull/1195

---
Regards,
Linux Bluetooth

#2 lore raw
In reply to Simon Mikuda
This patch was applied to bluetooth/bluetooth-next.git (master) by Luiz Augusto von Dentz <[email protected]>:

Hello:

This patch was applied to bluetooth/bluetooth-next.git (master) by Luiz Augusto von Dentz <[email protected]>:

Quoted 5 lines · On Sun, 22 Nov 2026 21:13:37 +0100 you wrote:

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:

Quoted 8 lines

< 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

[...]

Here is the summary with links:
- Bluetooth: hci_conn: Terminate a PA sync while other PA syncs are open

    https://git.kernel.org/bluetooth/bluetooth-next/c/28c476588666

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html