Linux bluetooth development
 help / color / mirror / Atom feed
* [PATCH] Bluetooth: hci_event: Don't keep the handle of a failed PA sync
@ 2026-11-24 15:07 Simon Mikuda
  2026-11-24 17:20 ` patchwork-bot+bluetooth
  0 siblings, 1 reply; 2+ messages in thread
From: Simon Mikuda @ 2026-11-24 15:07 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Simon Mikuda, Marcel Holtmann, Luiz Augusto von Dentz

A failed LE Periodic Advertising Sync Established still stores its invalid
handle, and the controller gives the same value to the next sync. The
lookup by handle finds the failed connection first, so the PA reports of
the next broadcaster go to it and bluetoothd never lists that broadcaster
(btmon, shortened, on a 6.18.2 based vendor kernel):

    PA Sync Established: Connection Failed to be Established (0x3e)
        Sync handle: 0, Advertiser address: 50:1E:2D:00:42:2D
    PA Sync Established: Success
        Sync handle: 0, Advertiser address: 50:1E:2D:A1:5F:1C
    MGMT Device Connected: 50:1E:2D:00:42:2D

Store the handle only for an established sync.

Fixes: d356c924e7a3 ("Bluetooth: ISO: Handle PA sync when no BIGInfo reports are generated")
Signed-off-by: Simon Mikuda <simon.mikuda@streamunlimited.com>
---
 net/bluetooth/hci_event.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c
index 610207e25fa4..35fc46dcfad0 100644
--- a/net/bluetooth/hci_event.c
+++ b/net/bluetooth/hci_event.c
@@ -6842,7 +6842,8 @@ static void hci_le_pa_sync_established_evt(struct hci_dev *hdev, void *data,
 
 	clear_bit(HCI_CONN_CREATE_PA_SYNC, conn->flags);
 
-	conn->sync_handle = le16_to_cpu(ev->handle);
+	if (!ev->status)
+		conn->sync_handle = le16_to_cpu(ev->handle);
 	conn->sid = HCI_SID_INVALID;
 
 	mask |= hci_proto_connect_ind(hdev, &ev->bdaddr, PA_LINK,
@@ -6862,7 +6863,8 @@ static void hci_le_pa_sync_established_evt(struct hci_dev *hdev, void *data,
 	if (IS_ERR(pa_sync))
 		goto unlock;
 
-	pa_sync->sync_handle = le16_to_cpu(ev->handle);
+	if (!ev->status)
+		pa_sync->sync_handle = le16_to_cpu(ev->handle);
 
 	if (ev->status) {
 		set_bit(HCI_CONN_PA_SYNC_FAILED, pa_sync->flags);

base-commit: 62fd917f6d2df1a399a453138c2b7cbd563f8f95
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-11-24 17:20 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-24 15:07 [PATCH] Bluetooth: hci_event: Don't keep the handle of a failed PA sync Simon Mikuda
2026-11-24 17:20 ` patchwork-bot+bluetooth

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox