Linux bluetooth development
 help / color / mirror / Atom feed
* [PATCH] Bluetooth: hci_event: Terminate a PA sync nobody accepts
@ 2026-11-24 15:08 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:08 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Simon Mikuda, Marcel Holtmann, Luiz Augusto von Dentz

The accept mask of hci_le_pa_sync_established_evt() starts from
hdev->link_mode, which has HCI_LM_ACCEPT set by default, so a PA sync no
ISO socket accepted is never terminated. This happens when the listening
socket closes while the sync is pending. Every later sync to that source
then fails until it stops advertising:

    < LE Periodic Advertising Create Sync  50:1E:2D:A1:5F:1C
      (listening socket closed)
    > LE Periodic Advertising Sync Established  Status: Success
      (no LE Periodic Advertising Terminate Sync)
    < LE Periodic Advertising Create Sync  50:1E:2D:A1:5F:1C
    > Command Status  ACL Connection Already Exists (0x0b)

Only ISO can accept a PA sync, so start from 0 and let
hci_proto_connect_ind() decide. Terminate only an established sync. A
failed sync has no handle, so the handle in its event means nothing and
can be the handle of another sync. The NXP IW612 Bluetooth chip, for
example, reports a cancelled create with handle 0.

Fixes: eca0ae4aea66 ("Bluetooth: Add initial implementation of BIS connections")
Signed-off-by: Simon Mikuda <simon.mikuda@streamunlimited.com>
---
 net/bluetooth/hci_event.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c
index 610207e25fa4..2da77ebee12d 100644
--- a/net/bluetooth/hci_event.c
+++ b/net/bluetooth/hci_event.c
@@ -6814,7 +6814,7 @@ static void hci_le_pa_sync_established_evt(struct hci_dev *hdev, void *data,
 					   struct sk_buff *skb)
 {
 	struct hci_ev_le_pa_sync_established *ev = data;
-	int mask = hdev->link_mode;
+	int mask = 0;
 	__u8 flags = 0;
 	struct hci_conn *pa_sync, *conn;
 
@@ -6848,7 +6848,11 @@ static void hci_le_pa_sync_established_evt(struct hci_dev *hdev, void *data,
 	mask |= hci_proto_connect_ind(hdev, &ev->bdaddr, PA_LINK,
 				      &flags);
 	if (!(mask & HCI_LM_ACCEPT)) {
-		hci_le_pa_term_sync(hdev, ev->handle);
+		/* A failed sync has no handle, the one in the event may be
+		 * another sync's.
+		 */
+		if (!ev->status)
+			hci_le_pa_term_sync(hdev, ev->handle);
 		goto unlock;
 	}
 

base-commit: 62fd917f6d2df1a399a453138c2b7cbd563f8f95
-- 
2.43.0


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

* Re: [PATCH] Bluetooth: hci_event: Terminate a PA sync nobody accepts
  2026-11-24 15:08 [PATCH] Bluetooth: hci_event: Terminate a PA sync nobody accepts Simon Mikuda
@ 2026-11-24 17:20 ` patchwork-bot+bluetooth
  0 siblings, 0 replies; 2+ messages in thread
From: patchwork-bot+bluetooth @ 2026-11-24 17:20 UTC (permalink / raw)
  To: Simon Mikuda; +Cc: linux-bluetooth, marcel, luiz.dentz

Hello:

This patch was applied to bluetooth/bluetooth-next.git (master)
by Luiz Augusto von Dentz <luiz.von.dentz@intel.com>:

On Tue, 24 Nov 2026 16:08:51 +0100 you wrote:
> The accept mask of hci_le_pa_sync_established_evt() starts from
> hdev->link_mode, which has HCI_LM_ACCEPT set by default, so a PA sync no
> ISO socket accepted is never terminated. This happens when the listening
> socket closes while the sync is pending. Every later sync to that source
> then fails until it stops advertising:
> 
>     < LE Periodic Advertising Create Sync  50:1E:2D:A1:5F:1C
>       (listening socket closed)
>     > LE Periodic Advertising Sync Established  Status: Success
>       (no LE Periodic Advertising Terminate Sync)
>     < LE Periodic Advertising Create Sync  50:1E:2D:A1:5F:1C
>     > Command Status  ACL Connection Already Exists (0x0b)
> 
> [...]

Here is the summary with links:
  - Bluetooth: hci_event: Terminate a PA sync nobody accepts
    https://git.kernel.org/bluetooth/bluetooth-next/c/4d4a9dd600df

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[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:08 [PATCH] Bluetooth: hci_event: Terminate a PA sync nobody accepts 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