Skip to contentSkip to conversation

Bluetooth: hci_core: lookup pa sync need check BIG sync state

PATCH In review Yang Li 3 participants 8 messages Jul 2, 2025 – Jul 4, 2025

Subsystems (4)
lore
Share & tools
lore

Yang Li

author
#0 lore raw

PATCH 1/1 Bluetooth: hci_core: lookup pa sync need check BIG sync state

Ignore the big sync connections, we are looking for the PA sync connection that was created as a result of the PA sync established event.

---
 include/net/bluetooth/hci_core.h | 7 +++++++
 1 file changed, 7 insertions(+)
include/net/bluetooth/hci_core.h +7 -0
index 3ce1fb6f5822..646b0c5fd7a5 100644
@@ -1400,6 +1400,13 @@ hci_conn_hash_lookup_pa_sync_handle(struct hci_dev *hdev, __u16 sync_handle)
 		if (c->type != BIS_LINK)
 			continue;
 
+		/* Ignore the big sync connections, we are looking
+		 * for the PA sync connection that was created as
+		 * a result of the PA sync established event.
+		 */
+		if (test_bit(HCI_CONN_BIG_SYNC, &c->flags))
+			continue;
+
 		/* Ignore the listen hcon, we are looking
 		 * for the child hcon that was created as
 		 * a result of the PA sync established event.

---
base-commit: 3bc46213b81278f3a9df0324768e152de71eb9fe
change-id: 20250701-pa_sync-2fc7fc9f592c

Best regards,

Signature · 1 line
Yang Li <[email protected]>
#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/project/bluetooth/list/?series=977970

---Test result---

Test Summary:

CheckPatch                    PENDING   0.27 seconds
GitLint                       PENDING   0.23 seconds
SubjectPrefix                 PASS      0.12 seconds
BuildKernel                   PASS      24.75 seconds
CheckAllWarning               PASS      27.00 seconds
CheckSparse                   PASS      30.59 seconds
BuildKernel32                 PASS      24.63 seconds
TestRunnerSetup               FAIL      102.22 seconds
TestRunner_l2cap-tester       FAIL      0.45 seconds
TestRunner_iso-tester         FAIL      0.12 seconds
TestRunner_bnep-tester        FAIL      0.12 seconds
TestRunner_mgmt-tester        FAIL      0.12 seconds
TestRunner_rfcomm-tester      FAIL      0.12 seconds
TestRunner_sco-tester         FAIL      0.12 seconds
TestRunner_ioctl-tester       FAIL      0.12 seconds
TestRunner_mesh-tester        FAIL      0.44 seconds
TestRunner_smp-tester         FAIL      0.12 seconds
TestRunner_userchan-tester    FAIL      0.12 seconds
IncrementalBuild              PENDING   0.71 seconds

Details
##############################
Test: CheckPatch - PENDING
Desc: Run checkpatch.pl script
Output:

##############################
Test: GitLint - PENDING
Desc: Run gitlint
Output:

##############################
Test: TestRunnerSetup - FAIL
Desc: Setup kernel and bluez for test-runner
Output:
Bluez:
src/device.c: In function ‘connect_profiles’:
src/device.c:2689:6: error: ‘ERR_BREDR_CONN_PROFILE_UNAVAILABLE’ undeclared (first use in this function)

 2689 |      ERR_BREDR_CONN_PROFILE_UNAVAILABLE);
      |      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

src/device.c:2689:6: note: each undeclared identifier is reported only once for each function it appears in make[1]: *** [Makefile:11162: src/bluetoothd-device.o] Error 1
make[1]: *** Waiting for unfinished jobs....
make: *** [Makefile:4690: all] Error 2
##############################
Test: TestRunner_l2cap-tester - FAIL
Desc: Run l2cap-tester with test-runner
Output:
No tester found
##############################
Test: TestRunner_iso-tester - FAIL
Desc: Run iso-tester with test-runner
Output:
No tester found
##############################
Test: TestRunner_bnep-tester - FAIL
Desc: Run bnep-tester with test-runner
Output:
No tester found
##############################
Test: TestRunner_mgmt-tester - FAIL
Desc: Run mgmt-tester with test-runner
Output:
No tester found
##############################
Test: TestRunner_rfcomm-tester - FAIL
Desc: Run rfcomm-tester with test-runner
Output:
No tester found
##############################
Test: TestRunner_sco-tester - FAIL
Desc: Run sco-tester with test-runner
Output:
No tester found
##############################
Test: TestRunner_ioctl-tester - FAIL
Desc: Run ioctl-tester with test-runner
Output:
No tester found
##############################
Test: TestRunner_mesh-tester - FAIL
Desc: Run mesh-tester with test-runner
Output:
No tester found
##############################
Test: TestRunner_smp-tester - FAIL
Desc: Run smp-tester with test-runner
Output:
No tester found
##############################
Test: TestRunner_userchan-tester - FAIL
Desc: Run userchan-tester with test-runner
Output:
No tester found
##############################
Test: IncrementalBuild - PENDING
Desc: Incremental build with the patches in the series
Output:

---
Regards,
Linux Bluetooth

#2 lore raw
In reply to Yang Li

Hi,

Quoted 6 lines · On Tue, Jul 1, 2025 at 9:18 PM Yang Li via B4 Relay…

From: Yang Li <[email protected]>

Ignore the big sync connections, we are looking for the PA sync connection that was created as a result of the PA sync established event.

Were you seeing an issue with this, if you do please describe it and add the traces, debug logs, etc.

Quoted 10 lines
---
 include/net/bluetooth/hci_core.h | 7 +++++++
 1 file changed, 7 insertions(+)
include/net/bluetooth/hci_core.h +0 -0
index 3ce1fb6f5822..646b0c5fd7a5 100644

include/net/bluetooth/hci_core.h hci_conn_hash_lookup_pa_sync_handle(struct hci_dev *hdev, __u16 sync_handle) · line 1409

Quoted 10 lines
include/net/bluetooth/hci_core.h +7 -0
@@ -1400,6 +1400,13 @@ hci_conn_hash_lookup_pa_sync_handle(struct hci_dev *hdev, __u16 sync_handle)
                if (c->type != BIS_LINK)
                        continue;
 
+               /* Ignore the big sync connections, we are looking
+                * for the PA sync connection that was created as
+                * a result of the PA sync established event.
+                */
+               if (test_bit(HCI_CONN_BIG_SYNC, &c->flags))
+                       continue;
+

hci_conn_hash_lookup_pa_sync_big_handle does:

        if (c->type != BIS_LINK ||
            !test_bit(HCI_CONN_PA_SYNC, &c->flags))
Quoted 13 lines
include/net/bluetooth/hci_core.h +0 -1
                /* Ignore the listen hcon, we are looking
                 * for the child hcon that was created as
                 * a result of the PA sync established event.
 
---

base-commit: 3bc46213b81278f3a9df0324768e152de71eb9fe
change-id: 20250701-pa_sync-2fc7fc9f592c

Best regards,
--
Yang Li <[email protected]>

Signature · 1 line
Luiz Augusto von Dentz
author
#3 lore raw

Hi Luiz,

Quoted 6 lines

[ EXTERNAL EMAIL ]

Hi,

On Tue, Jul 1, 2025 at 9:18 PM Yang Li via B4 Relay <[email protected]> wrote:

Quoted 7 lines
Quoted 5 lines

From: Yang Li <[email protected]>

Ignore the big sync connections, we are looking for the PA sync connection that was created as a result of the PA sync established event.

Were you seeing an issue with this, if you do please describe it and add the traces, debug logs, etc.

Since the PA sync connection is set to BT_CONNECTED in hci_le_big_sync_established_evt, if its status is BT_CONNECTED when hci_abort_conn_sync is called, hci_disconnect_sync() will be executed, which will cause the PA sync connection to be deleted.

int hci_abort_conn_sync(struct hci_dev *hdev, struct hci_conn *conn, u8 reason) {
...
    switch (conn->state) {
    case BT_CONNECTED:
    case BT_CONFIG:
        err = hci_disconnect_sync(hdev, conn, reason);
        break;
...

stack trace as below:

[   55.154495][0 T1966  d.] CPU: 0 PID: 1966 Comm: kworker/u9:0 Tainted: G           O       6.6.77 #104 [   55.155721][0 T1966  d.] Hardware name: Amlogic (DT)
[   55.156336][0 T1966  d.] Workqueue: hci0 hci_cmd_sync_work
[   55.157018][0 T1966  d.] Call trace:
[   55.157461][0 T1966  d.]  dump_backtrace+0x94/0xec
[   55.158056][0 T1966  d.]  show_stack+0x18/0x24
[   55.158607][0 T1966  d.]  dump_stack_lvl+0x48/0x60
[   55.159205][0 T1966  d.]  dump_stack+0x18/0x24
[   55.159756][0 T1966  d.]  hci_conn_del+0x1c/0x12c
[   55.160341][0 T1966  d.]  hci_conn_failed+0xdc/0x150
[   55.160958][0 T1966  d.]  hci_abort_conn_sync+0x204/0x388
[   55.161630][0 T1966  d.]  abort_conn_sync+0x58/0x80
[   55.162237][0 T1966  d.]  hci_cmd_sync_work+0x94/0x100
[   55.162877][0 T1966  d.]  process_one_work+0x168/0x444
[   55.163516][0 T1966  d.]  worker_thread+0x378/0x3f4
[   55.164122][0 T1966  d.]  kthread+0x108/0x10c
[   55.164664][0 T1966  d.]  ret_from_fork+0x10/0x20
[   55.165408][0 T1966  d.] hci0 hcon 000000004f36962c handle 3841 #PA sync connection

btmon trace:

< HCI Command: Disconnect (0x01|0x0006) plen 3             #75 [hci0] 14.640630
        Handle: 3841
        Reason: Remote User Terminated Connection (0x13)

Quoted 1 line

HCI Event: Command Status (0x0f) plen 4                  #76 [hci0] 14.642103

      Disconnect (0x01|0x0006) ncmd 1
        Status: Invalid HCI Command Parameters (0x12)

So the current question is whether the PA sync connection, which is marked as BT_CONNECTED, really needs to be disconnected. If it does need to be disconnected, then the PA sync terminate command must be executed.
However, in my opinion, the PA sync connection should not be disconnected.

Quoted 42 lines
Quoted 11 lines
---
  include/net/bluetooth/hci_core.h | 7 +++++++
  1 file changed, 7 insertions(+)
include/net/bluetooth/hci_core.h +0 -0
index 3ce1fb6f5822..646b0c5fd7a5 100644

include/net/bluetooth/hci_core.h hci_conn_hash_lookup_pa_sync_handle(struct hci_dev *hdev, __u16 sync_handle) · line 1409

Quoted 10 lines
include/net/bluetooth/hci_core.h +7 -0
@@ -1400,6 +1400,13 @@ hci_conn_hash_lookup_pa_sync_handle(struct hci_dev *hdev, __u16 sync_handle)
                 if (c->type != BIS_LINK)
                         continue;
 
+               /* Ignore the big sync connections, we are looking
+                * for the PA sync connection that was created as
+                * a result of the PA sync established event.
+                */
+               if (test_bit(HCI_CONN_BIG_SYNC, &c->flags))
+                       continue;
+

hci_conn_hash_lookup_pa_sync_big_handle does:

         if (c->type != BIS_LINK ||
             !test_bit(HCI_CONN_PA_SYNC, &c->flags))
Quoted 8 lines
include/net/bluetooth/hci_core.h +0 -1
                 /* Ignore the listen hcon, we are looking
                  * for the child hcon that was created as
                  * a result of the PA sync established event.
 
---

base-commit: 3bc46213b81278f3a9df0324768e152de71eb9fe
change-id: 20250701-pa_sync-2fc7fc9f592c

Quoted 5 lines

Best regards,
--
Yang Li <[email protected]>

--
Luiz Augusto von Dentz

author
#4 lore raw

Hi,
Please forgive my oversight,
I replied to the wrong email. Kindly ignore that response.

Quoted 107 lines

Hi Luiz,

Quoted 6 lines

[ EXTERNAL EMAIL ]

Hi,

On Tue, Jul 1, 2025 at 9:18 PM Yang Li via B4 Relay <[email protected]> wrote:

Quoted 7 lines
Quoted 5 lines

From: Yang Li <[email protected]>

Ignore the big sync connections, we are looking for the PA sync connection that was created as a result of the PA sync established event.

Were you seeing an issue with this, if you do please describe it and add the traces, debug logs, etc.

Since the PA sync connection is set to BT_CONNECTED in hci_le_big_sync_established_evt, if its status is BT_CONNECTED when hci_abort_conn_sync is called, hci_disconnect_sync() will be executed, which will cause the PA sync connection to be deleted.

int hci_abort_conn_sync(struct hci_dev *hdev, struct hci_conn *conn, u8 reason) {
...
    switch (conn->state) {
    case BT_CONNECTED:
    case BT_CONFIG:
        err = hci_disconnect_sync(hdev, conn, reason);
        break;
...

stack trace as below:

[   55.154495][0 T1966  d.] CPU: 0 PID: 1966 Comm: kworker/u9:0 Tainted: G           O       6.6.77 #104 [   55.155721][0 T1966  d.] Hardware name: Amlogic (DT)
[   55.156336][0 T1966  d.] Workqueue: hci0 hci_cmd_sync_work
[   55.157018][0 T1966  d.] Call trace:
[   55.157461][0 T1966  d.]  dump_backtrace+0x94/0xec
[   55.158056][0 T1966  d.]  show_stack+0x18/0x24
[   55.158607][0 T1966  d.]  dump_stack_lvl+0x48/0x60
[   55.159205][0 T1966  d.]  dump_stack+0x18/0x24
[   55.159756][0 T1966  d.]  hci_conn_del+0x1c/0x12c
[   55.160341][0 T1966  d.]  hci_conn_failed+0xdc/0x150
[   55.160958][0 T1966  d.]  hci_abort_conn_sync+0x204/0x388
[   55.161630][0 T1966  d.]  abort_conn_sync+0x58/0x80
[   55.162237][0 T1966  d.]  hci_cmd_sync_work+0x94/0x100
[   55.162877][0 T1966  d.]  process_one_work+0x168/0x444
[   55.163516][0 T1966  d.]  worker_thread+0x378/0x3f4
[   55.164122][0 T1966  d.]  kthread+0x108/0x10c
[   55.164664][0 T1966  d.]  ret_from_fork+0x10/0x20
[   55.165408][0 T1966  d.] hci0 hcon 000000004f36962c handle 3841 #PA sync connection

btmon trace:

< HCI Command: Disconnect (0x01|0x0006) plen 3             #75 [hci0] 14.640630
        Handle: 3841
        Reason: Remote User Terminated Connection (0x13)

Quoted 1 line

HCI Event: Command Status (0x0f) plen 4                  #76 [hci0]

14.642103
      Disconnect (0x01|0x0006) ncmd 1
        Status: Invalid HCI Command Parameters (0x12)

So the current question is whether the PA sync connection, which is marked as BT_CONNECTED, really needs to be disconnected. If it does need to be disconnected, then the PA sync terminate command must be executed.
However, in my opinion, the PA sync connection should not be disconnected.

Quoted 43 lines
Quoted 12 lines

---
  include/net/bluetooth/hci_core.h | 7 +++++++

  1 file changed, 7 insertions(+)
include/net/bluetooth/hci_core.h +0 -0
index 3ce1fb6f5822..646b0c5fd7a5 100644
@@ -1400,6 +1400,13 @@ hci_conn_hash_lookup_pa_sync_handle(struct 
 hci_dev *hdev, __u16 sync_handle)

include/net/bluetooth/hci_core.h hci_conn_hash_lookup_pa_sync_handle(struct · line 1410

Quoted 10 lines
include/net/bluetooth/hci_core.h +7 -0
                  if (c->type != BIS_LINK)
                          continue;
 
+               /* Ignore the big sync connections, we are looking
+                * for the PA sync connection that was created as
+                * a result of the PA sync established event.
+                */
+               if (test_bit(HCI_CONN_BIG_SYNC, &c->flags))
+                       continue;
+

hci_conn_hash_lookup_pa_sync_big_handle does:

         if (c->type != BIS_LINK || !test_bit(HCI_CONN_PA_SYNC, &c->flags))

Quoted 13 lines
include/net/bluetooth/hci_core.h +0 -0
                  /* Ignore the listen hcon, we are looking
                   * for the child hcon that was created as

                  * a result of the PA sync established event.

---
base-commit: 3bc46213b81278f3a9df0324768e152de71eb9fe
change-id: 20250701-pa_sync-2fc7fc9f592c

Best regards,

Signature · 1 line
Yang Li <[email protected]>
Signature · 1 line
Luiz Augusto von Dentz
author
#5 lore raw
In reply to Luiz Augusto von Dentz

Hi luiz,

Quoted 6 lines

[ EXTERNAL EMAIL ]

Hi,

On Tue, Jul 1, 2025 at 9:18 PM Yang Li via B4 Relay <[email protected]> wrote:

Quoted 7 lines
Quoted 5 lines

From: Yang Li <[email protected]>

Ignore the big sync connections, we are looking for the PA sync connection that was created as a result of the PA sync established event.

Were you seeing an issue with this, if you do please describe it and add the traces, debug logs, etc.

connect list:

[   61.826679][2 T1974  d.] list conn: conn 00000000a6e8ac83 handle 0x0f01 state 1, flags 0x40000220

pa_sync_conn.flags = HCI_CONN_PA_SYNC

[   61.827155][2 T1974  d.] list conn: conn 0000000073b03cb6 handle 0x0100 state 1, flags 0x48000220 [   61.828254][2 T1974  d.] list conn: conn 00000000a7e091c9 handle 0x0101 state 1, flags 0x48000220

big_sync_conn.flags = HCI_CONN_PA_SYNC | HCI_CONN_BIG_SYNC

If the PA sync connection is deleted, then when hci_le_big_sync_lost_evt is executed, hci_conn_hash_lookup_pa_sync_handle should return NULL, However, it currently returns the BIS1 connection instead, because bis conn also has HCI_CONN_PA_SYNC set.

Therefore, I added an HCI_CONN_BIG_SYNC check in hci_conn_hash_lookup_pa_sync_handle to filter out BIS connections.

Quoted 23 lines
Quoted 11 lines
---
  include/net/bluetooth/hci_core.h | 7 +++++++
  1 file changed, 7 insertions(+)
include/net/bluetooth/hci_core.h +0 -0
index 3ce1fb6f5822..646b0c5fd7a5 100644

include/net/bluetooth/hci_core.h hci_conn_hash_lookup_pa_sync_handle(struct hci_dev *hdev, __u16 sync_handle) · line 1409

Quoted 10 lines
include/net/bluetooth/hci_core.h +7 -0
@@ -1400,6 +1400,13 @@ hci_conn_hash_lookup_pa_sync_handle(struct hci_dev *hdev, __u16 sync_handle)
                 if (c->type != BIS_LINK)
                         continue;
 
+               /* Ignore the big sync connections, we are looking
+                * for the PA sync connection that was created as
+                * a result of the PA sync established event.
+                */
+               if (test_bit(HCI_CONN_BIG_SYNC, &c->flags))
+                       continue;
+

hci_conn_hash_lookup_pa_sync_big_handle does:

Quoted 2 lines
         if (c->type != BIS_LINK ||
             !test_bit(HCI_CONN_PA_SYNC, &c->flags))

Please forgive my misunderstanding.

Quoted 17 lines
Quoted 9 lines
include/net/bluetooth/hci_core.h +0 -1
                 /* Ignore the listen hcon, we are looking
                  * for the child hcon that was created as
                  * a result of the PA sync established event.
 
---

base-commit: 3bc46213b81278f3a9df0324768e152de71eb9fe
change-id: 20250701-pa_sync-2fc7fc9f592c

Quoted 5 lines

Best regards,
--
Yang Li <[email protected]>

--
Luiz Augusto von Dentz

#6 lore raw

Hi,

Quoted 22 lines · Yang Li

Hi luiz,

Quoted 6 lines

[ EXTERNAL EMAIL ]

Hi,

On Tue, Jul 1, 2025 at 9:18 PM Yang Li via B4 Relay <[email protected]> wrote:

Quoted 7 lines
Quoted 5 lines

From: Yang Li <[email protected]>

Ignore the big sync connections, we are looking for the PA sync connection that was created as a result of the PA sync established event.

Were you seeing an issue with this, if you do please describe it and add the traces, debug logs, etc.

connect list:

[   61.826679][2 T1974  d.] list conn: conn 00000000a6e8ac83 handle

0x0f01 state 1, flags 0x40000220

Quoted 8 lines

pa_sync_conn.flags = HCI_CONN_PA_SYNC

[   61.827155][2 T1974  d.] list conn: conn 0000000073b03cb6 handle
0x0100 state 1, flags 0x48000220
[   61.828254][2 T1974  d.] list conn: conn 00000000a7e091c9 handle

0x0101 state 1, flags 0x48000220

big_sync_conn.flags = HCI_CONN_PA_SYNC | HCI_CONN_BIG_SYNC

This is a bug then, it should have both PA_SYNC and BIG_SYNC together, also I think we should probably disambiguate this by not using BIS_LINK for PA_SYNC, byt introducing PA_LINK as conn->type.

Quoted 55 lines

If the PA sync connection is deleted, then when hci_le_big_sync_lost_evt is executed, hci_conn_hash_lookup_pa_sync_handle should return NULL, However, it currently returns the BIS1 connection instead, because bis conn also has HCI_CONN_PA_SYNC set.

Therefore, I added an HCI_CONN_BIG_SYNC check in hci_conn_hash_lookup_pa_sync_handle to filter out BIS connections.

Quoted 23 lines
Quoted 11 lines
---
  include/net/bluetooth/hci_core.h | 7 +++++++
  1 file changed, 7 insertions(+)
include/net/bluetooth/hci_core.h +0 -0
index 3ce1fb6f5822..646b0c5fd7a5 100644

include/net/bluetooth/hci_core.h hci_conn_hash_lookup_pa_sync_handle(struct hci_dev *hdev, __u16 sync_handle) · line 1409

Quoted 10 lines
include/net/bluetooth/hci_core.h +7 -0
@@ -1400,6 +1400,13 @@ hci_conn_hash_lookup_pa_sync_handle(struct hci_dev *hdev, __u16 sync_handle)
                 if (c->type != BIS_LINK)
                         continue;
 
+               /* Ignore the big sync connections, we are looking
+                * for the PA sync connection that was created as
+                * a result of the PA sync established event.
+                */
+               if (test_bit(HCI_CONN_BIG_SYNC, &c->flags))
+                       continue;
+

hci_conn_hash_lookup_pa_sync_big_handle does:

Quoted 2 lines
         if (c->type != BIS_LINK ||
             !test_bit(HCI_CONN_PA_SYNC, &c->flags))

Please forgive my misunderstanding.

Quoted 17 lines
Quoted 9 lines
include/net/bluetooth/hci_core.h +0 -1
                 /* Ignore the listen hcon, we are looking
                  * for the child hcon that was created as
                  * a result of the PA sync established event.
 
---

base-commit: 3bc46213b81278f3a9df0324768e152de71eb9fe
change-id: 20250701-pa_sync-2fc7fc9f592c

Quoted 5 lines

Best regards,
--
Yang Li <[email protected]>

--
Luiz Augusto von Dentz

Signature · 1 line
Luiz Augusto von Dentz
author
#7 lore raw

Hi Luiz,

Quoted 32 lines

[ EXTERNAL EMAIL ]

Hi,

Quoted 27 lines · Yang Li

Hi luiz,

Quoted 6 lines

[ EXTERNAL EMAIL ]

Hi,

On Tue, Jul 1, 2025 at 9:18 PM Yang Li via B4 Relay <[email protected]> wrote:

Quoted 7 lines
Quoted 5 lines

From: Yang Li <[email protected]>

Ignore the big sync connections, we are looking for the PA sync connection that was created as a result of the PA sync established event.

Were you seeing an issue with this, if you do please describe it and add the traces, debug logs, etc.

connect list:

[   61.826679][2 T1974  d.] list conn: conn 00000000a6e8ac83 handle

0x0f01 state 1, flags 0x40000220

pa_sync_conn.flags = HCI_CONN_PA_SYNC

[   61.827155][2 T1974  d.] list conn: conn 0000000073b03cb6 handle
0x0100 state 1, flags 0x48000220
[   61.828254][2 T1974  d.] list conn: conn 00000000a7e091c9 handle

0x0101 state 1, flags 0x48000220

Quoted 4 lines
Quoted 1 line

big_sync_conn.flags = HCI_CONN_PA_SYNC | HCI_CONN_BIG_SYNC

This is a bug then, it should have both PA_SYNC and BIG_SYNC together, also I think we should probably disambiguate this by not using BIS_LINK for PA_SYNC, byt introducing PA_LINK as conn->type.

Yes, I agree with your point.

Adding PA_LINK can make it clearer to distinguish between PA sync and BIG sync links.

Let me try to update it accordingly.

Quoted 55 lines
Quoted 31 lines

If the PA sync connection is deleted, then when hci_le_big_sync_lost_evt is executed, hci_conn_hash_lookup_pa_sync_handle should return NULL, However, it currently returns the BIS1 connection instead, because bis conn also has HCI_CONN_PA_SYNC set.

Therefore, I added an HCI_CONN_BIG_SYNC check in hci_conn_hash_lookup_pa_sync_handle to filter out BIS connections.

Quoted 22 lines
Quoted 10 lines
---
   include/net/bluetooth/hci_core.h | 7 +++++++
   1 file changed, 7 insertions(+)
include/net/bluetooth/hci_core.h +0 -0
index 3ce1fb6f5822..646b0c5fd7a5 100644

include/net/bluetooth/hci_core.h hci_conn_hash_lookup_pa_sync_handle(struct hci_dev *hdev, __u16 sync_handle) · line 1409

Quoted 10 lines
include/net/bluetooth/hci_core.h +7 -0
@@ -1400,6 +1400,13 @@ hci_conn_hash_lookup_pa_sync_handle(struct hci_dev *hdev, __u16 sync_handle)
                  if (c->type != BIS_LINK)
                          continue;
 
+               /* Ignore the big sync connections, we are looking
+                * for the PA sync connection that was created as
+                * a result of the PA sync established event.
+                */
+               if (test_bit(HCI_CONN_BIG_SYNC, &c->flags))
+                       continue;
+

hci_conn_hash_lookup_pa_sync_big_handle does:

Quoted 20 lines
Quoted 2 lines
          if (c->type != BIS_LINK ||
              !test_bit(HCI_CONN_PA_SYNC, &c->flags))

Please forgive my misunderstanding.

Quoted 15 lines
Quoted 8 lines
include/net/bluetooth/hci_core.h +0 -1
                  /* Ignore the listen hcon, we are looking
                   * for the child hcon that was created as
                   * a result of the PA sync established event.
 
---

base-commit: 3bc46213b81278f3a9df0324768e152de71eb9fe
change-id: 20250701-pa_sync-2fc7fc9f592c

Quoted 5 lines

Best regards,
--
Yang Li <[email protected]>

--
Luiz Augusto von Dentz

--
Luiz Augusto von Dentz