From: Simon Mikuda <simon.mikuda@streamunlimited.com>
To: linux-bluetooth@vger.kernel.org
Cc: Simon Mikuda <simon.mikuda@streamunlimited.com>,
Marcel Holtmann <marcel@holtmann.org>,
Luiz Augusto von Dentz <luiz.dentz@gmail.com>
Subject: [PATCH] Bluetooth: hci_event: Don't report a cancelled PA sync as failed
Date: Sun, 22 Nov 2026 21:15:18 +0100 [thread overview]
Message-ID: <20261122201519.2859075-1-simon.mikuda@streamunlimited.com> (raw)
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")
Signed-off-by: Simon Mikuda <simon.mikuda@streamunlimited.com>
---
net/bluetooth/hci_event.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c
index 039bcea98a5a..ebddf5d62f35 100644
--- a/net/bluetooth/hci_event.c
+++ b/net/bluetooth/hci_event.c
@@ -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
--
2.43.0
next reply other threads:[~2026-11-22 20:15 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-22 20:15 Simon Mikuda [this message]
2026-11-22 22:56 ` Bluetooth: hci_event: Don't report a cancelled PA sync as failed bluez.test.bot
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261122201519.2859075-1-simon.mikuda@streamunlimited.com \
--to=simon.mikuda@streamunlimited.com \
--cc=linux-bluetooth@vger.kernel.org \
--cc=luiz.dentz@gmail.com \
--cc=marcel@holtmann.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox