Bluetooth: hci_sync: use HCI_CMD_TIMEOUT for PA sync commands
Subsystems (2)
PATCH 1/1 Bluetooth: hci_sync: use HCI_CMD_TIMEOUT for PA sync commands
PA sync HCI commands incorrectly use conn->conn_timeout, which defaults to 20s and is too long. If the PA Sync Established event is not received, the command remains pending and causes userspace timeouts.
--- net/bluetooth/hci_sync.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
net/bluetooth/hci_sync.c +2 -2
@@ -7159,7 +7159,7 @@ static int hci_le_pa_create_sync(struct hci_dev *hdev, void *data)if (conn->sid ==HCI_SID_INVALID ) { err =__hci_cmd_sync_status_sk (hdev,HCI_OP_NOP ,0 ,NULL ,HCI_EV_LE_EXT_ADV_REPORT , - conn->conn_timeout,NULL ); +HCI_CMD_TIMEOUT ,NULL );if (err == -ETIMEDOUT ) goto done; }
@@ -7187,7 +7187,7 @@ static int hci_le_pa_create_sync(struct hci_dev *hdev, void *data) err =__hci_cmd_sync_status_sk (hdev,HCI_OP_LE_PA_CREATE_SYNC ,sizeof (cp), &cp,HCI_EV_LE_PA_SYNC_ESTABLISHED , - conn->conn_timeout,NULL ); +HCI_CMD_TIMEOUT ,NULL );if (err == -ETIMEDOUT )__hci_cmd_sync_status (hdev,HCI_OP_LE_PA_CREATE_SYNC_CANCEL ,0 ,NULL ,HCI_CMD_TIMEOUT );
---
base-commit: bdb9aba465a85122bcba01a6154e237b9843e25b
change-id: 20260108-pa_sync_cmd_timeout-ff46f67b5d2a
Best regards,
Signature · 1 line
Yang Li <[email protected]>
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=1039696
---Test result---
Test Summary:
CheckPatch PENDING 0.45 seconds GitLint PENDING 0.37 seconds SubjectPrefix PASS 0.06 seconds BuildKernel PASS 26.24 seconds CheckAllWarning PASS 28.65 seconds CheckSparse PASS 32.23 seconds BuildKernel32 PASS 25.81 seconds TestRunnerSetup PASS 558.09 seconds TestRunner_l2cap-tester FAIL 28.40 seconds TestRunner_iso-tester PASS 57.14 seconds TestRunner_bnep-tester PASS 6.28 seconds TestRunner_mgmt-tester FAIL 124.49 seconds TestRunner_rfcomm-tester PASS 9.56 seconds TestRunner_sco-tester FAIL 14.93 seconds TestRunner_ioctl-tester PASS 10.08 seconds TestRunner_mesh-tester FAIL 11.50 seconds TestRunner_smp-tester PASS 8.50 seconds TestRunner_userchan-tester PASS 6.68 seconds IncrementalBuild PENDING 0.57 seconds
Details
##############################
Test: CheckPatch - PENDING
Desc: Run checkpatch.pl script
Output:
##############################
Test: GitLint - PENDING
Desc: Run gitlint
Output:
##############################
Test: TestRunner_l2cap-tester - FAIL
Desc: Run l2cap-tester with test-runner Output:
Total: 96, Passed: 94 (97.9%), Failed: 2, Not Run: 0
Failed Test Cases
L2CAP BR/EDR Server - Set PHY 2M Failed 0.120 seconds L2CAP LE Client - Set PHY Coded Failed 0.156 seconds
##############################
Test: TestRunner_mgmt-tester - FAIL
Desc: Run mgmt-tester with test-runner Output:
Total: 494, Passed: 489 (99.0%), Failed: 1, Not Run: 4
Failed Test Cases
Read Exp Feature - Success Failed 0.110 seconds
##############################
Test: TestRunner_sco-tester - FAIL
Desc: Run sco-tester with test-runner
Output:
WARNING: possible circular locking dependency detected
BUG: sleeping function called from invalid context at net/core/sock.c:3782
Total: 30, Passed: 30 (100.0%), Failed: 0, Not Run: 0
##############################
Test: TestRunner_mesh-tester - FAIL
Desc: Run mesh-tester with test-runner Output:
Total: 10, Passed: 8 (80.0%), Failed: 2, Not Run: 0
Failed Test Cases
Mesh - Send cancel - 1 Timed out 1.903 seconds Mesh - Send cancel - 2 Timed out 1.994 seconds
##############################
Test: IncrementalBuild - PENDING
Desc: Incremental build with the patches in the series Output:
---
Regards,
Linux Bluetooth
Luiz Augusto von Dentz
maintainerHi Yang,
Quoted 6 lines · On Thu, Jan 8, 2026 at 1:03 AM Yang Li via B4 Relay…
From: Yang Li <[email protected]>
PA sync HCI commands incorrectly use
conn->conn_timeout, which defaults to 20s and is too long. If the PA Sync Established event is not received, the command remains pending and causes userspace timeouts.
Im pretty sure this is impossible scenario with bluetooth-next, since
1. only one work can be running hci_le_pa_create_sync at time so HCI_EV_LE_PA_SYNC_ESTABLISHED cannot be outstanding 2. The conn->timeout shall be aligned with socket timeout so perhaps the problem is userspace is not setting the socket timeout correctly or something.
Quoted 37 lines
Signed-off-by Yang Li <[email protected]>--- net/bluetooth/hci_sync.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)net/bluetooth/hci_sync.c +2
-3@@ -7159,7 +7159,7 @@ static int hci_le_pa_create_sync(struct hci_dev *hdev, void *data)if (conn->sid ==HCI_SID_INVALID ) { err =__hci_cmd_sync_status_sk (hdev,HCI_OP_NOP ,0 ,NULL ,HCI_EV_LE_EXT_ADV_REPORT , - conn->conn_timeout,NULL ); +HCI_CMD_TIMEOUT ,NULL );if (err == -ETIMEDOUT ) goto done; }@@ -7187,7 +7187,7 @@ static int hci_le_pa_create_sync(struct hci_dev *hdev, void *data) err =__hci_cmd_sync_status_sk (hdev,HCI_OP_LE_PA_CREATE_SYNC ,sizeof (cp), &cp,HCI_EV_LE_PA_SYNC_ESTABLISHED , - conn->conn_timeout,NULL ); +HCI_CMD_TIMEOUT ,NULL );if (err == -ETIMEDOUT )__hci_cmd_sync_status (hdev,HCI_OP_LE_PA_CREATE_SYNC_CANCEL ,0 ,NULL ,HCI_CMD_TIMEOUT ); ---base-commit:
bdb9aba465a85122bcba01a6154e237b9843e25b
change-id: 20260108-pa_sync_cmd_timeout-ff46f67b5d2aBest regards,
--
Yang Li <[email protected]>
Signature · 1 line
Luiz Augusto von Dentz
Hi Luiz
Quoted 11 lines
[ EXTERNAL EMAIL ]
Hi Yang,
Quoted 5 lines · On Thu, Jan 8, 2026 at 1:03 AM Yang Li via B4 Relay…
From: Yang Li <[email protected]>
PA sync HCI commands incorrectly use
conn->conn_timeout, which defaults to 20s and is too long. If the PA Sync Established event is not received, the command remains pending and causes userspace timeouts.
Quoted 6 lines
Im pretty sure this is impossible scenario with bluetooth-next, since
1. only one work can be runninghci_le_pa_create_syncat time soHCI_EV_LE_PA_SYNC_ESTABLISHEDcannot be outstanding 2. Theconn->timeoutshall be aligned with socket timeout so perhaps the problem is userspace is not setting the socket timeout correctly or something.
Well, I got it.
I noticed that BlueZ has a default setting for sync_time with the value BT_ISO_SYNC_TIMEOUT=0x07d0 /* 20 secs */.
I would like to know the rationale behind setting it to 20 seconds initially. This value seems a bit long to me. Can I directly change this value as:
BT_ISO_SYNC_TIMEOUT=0x00C8 /* 2 secs */
Quoted 40 lines
Quoted 32 lines
Signed-off-by Yang Li <[email protected]>--- net/bluetooth/hci_sync.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)net/bluetooth/hci_sync.c +2
-3@@ -7159,7 +7159,7 @@ static int hci_le_pa_create_sync(struct hci_dev *hdev, void *data)if (conn->sid ==HCI_SID_INVALID ) { err =__hci_cmd_sync_status_sk (hdev,HCI_OP_NOP ,0 ,NULL ,HCI_EV_LE_EXT_ADV_REPORT , - conn->conn_timeout,NULL ); +HCI_CMD_TIMEOUT ,NULL );if (err == -ETIMEDOUT ) goto done; }@@ -7187,7 +7187,7 @@ static int hci_le_pa_create_sync(struct hci_dev *hdev, void *data) err =__hci_cmd_sync_status_sk (hdev,HCI_OP_LE_PA_CREATE_SYNC ,sizeof (cp), &cp,HCI_EV_LE_PA_SYNC_ESTABLISHED , - conn->conn_timeout,NULL ); +HCI_CMD_TIMEOUT ,NULL );if (err == -ETIMEDOUT )__hci_cmd_sync_status (hdev,HCI_OP_LE_PA_CREATE_SYNC_CANCEL ,0 ,NULL ,HCI_CMD_TIMEOUT ); ---base-commit:
bdb9aba465a85122bcba01a6154e237b9843e25b
change-id: 20260108-pa_sync_cmd_timeout-ff46f67b5d2aQuoted 5 lines
Best regards,
--
Yang Li <[email protected]>--
Luiz Augusto von Dentz