Skip to contentSkip to conversation

Bluetooth: hci_event: Don't report a cancelled PA sync as failed

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_event: Don't report a cancelled PA sync as failed

When HCI_LE_Periodic_Advertising_Sync_Established is not received in time, hci_le_pa_create_sync() cancels the request and returns -ETIMEDOUT, which create_pa_complete() reports to the ISO layer.

The controller then generates the event with status Operation Cancelled by Host, after the command complete of the cancel, so it may be handled only after create_pa_complete() has cleared HCI_CONN_CREATE_PA_SYNC and the next queued hci_le_pa_create_sync() has set it in the connection of another request. hci_le_pa_sync_established_evt() then takes the stale event for that request and clears its flag, so the event the controller generates for that request finds no connection and is dropped.

Handled earlier, the event is either logged as received for an unknown connection or, before create_pa_complete() runs, reported as a failure of the timed out request, which create_pa_complete() then reports again unless "Bluetooth: hci_sync: Don't report a timed out PA sync twice" is applied.

Ignore the event with that status.

Fixes e2d471b7806b ("Bluetooth: ISO: Fix not using SID from adv report")
Fixes 41bf23338a50 ("Bluetooth: hci_conn: Fix not cleaning up PA_LINK connections")
---
 net/bluetooth/hci_event.c | 7 +++++++
 1 file changed, 7 insertions(+)
net/bluetooth/hci_event.c +7 -0
index 039bcea98a5a..ebddf5d62f35 100644
@@ -6814,6 +6814,13 @@ static void hci_le_pa_sync_established_evt(struct hci_dev *hdev, void *data,
 
 	bt_dev_dbg(hdev, "status 0x%2.2x", ev->status);
 
+	/* HCI_LE_Periodic_Advertising_Create_Sync_Cancel is only sent when
+	 * hci_le_pa_create_sync() times out, which create_pa_complete()
+	 * already reports.
+	 */
+	if (ev->status == HCI_ERROR_CANCELLED_BY_HOST)
+		return;
+
 	hci_dev_lock(hdev);
 	hci_store_wake_reason(hdev, &ev->bdaddr, ev->bdaddr_type);
 

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/1218955/

---Test result---

Test Summary:

CheckPatch                    PASS      0.62 seconds
VerifyFixes                   PASS      0.07 seconds
VerifySignedoff               PASS      0.07 seconds
GitLint                       PASS      0.24 seconds
SubjectPrefix                 PASS      0.07 seconds
BuildKernel                   PASS      31.62 seconds
CheckAllWarning               PASS      34.50 seconds
CheckSparse                   WARNING   36.75 seconds
BuildKernel32                 PASS      30.73 seconds
CheckKernelLLVM               PASS      34.09 seconds
TestRunnerSetup               PASS      739.39 seconds
TestRunner_l2cap-tester       PASS      14.80 seconds
TestRunner_iso-tester         PASS      17.13 seconds
TestRunner_bnep-tester        PASS      3.13 seconds
TestRunner_mgmt-tester        PASS      88.86 seconds
TestRunner_rfcomm-tester      PASS      4.44 seconds
TestRunner_sco-tester         PASS      5.59 seconds
TestRunner_ioctl-tester       PASS      4.65 seconds
TestRunner_mesh-tester        PASS      4.45 seconds
TestRunner_smp-tester         PASS      4.34 seconds
TestRunner_userchan-tester    PASS      3.19 seconds
TestRunner_6lowpan-tester     PASS      4.37 seconds
IncrementalBuild              PASS      28.26 seconds

Details
##############################
Test: CheckSparse - WARNING
Desc: Run sparse tool with linux kernel
Output:
net/bluetooth/hci_event.c: note: in included file (through include/net/bluetooth/hci_core.h):

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

---
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 12 lines · On Sun, 22 Nov 2026 21:15:18 +0100 you wrote:

When HCI_LE_Periodic_Advertising_Sync_Established is not received in time, hci_le_pa_create_sync() cancels the request and returns -ETIMEDOUT, which create_pa_complete() reports to the ISO layer.

The controller then generates the event with status Operation Cancelled by Host, after the command complete of the cancel, so it may be handled only after create_pa_complete() has cleared HCI_CONN_CREATE_PA_SYNC and the next queued hci_le_pa_create_sync() has set it in the connection of another request. hci_le_pa_sync_established_evt() then takes the stale event for that request and clears its flag, so the event the controller generates for that request finds no connection and is dropped.

Quoted 1 line

[...]

Here is the summary with links:
- Bluetooth: hci_event: Don't report a cancelled PA sync as failed

    https://git.kernel.org/bluetooth/bluetooth-next/c/a9e7a232ef4d

You are awesome, thank you!

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