Linux bluetooth development
 help / color / mirror / Atom feed
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_sync: Sync to an RPA broadcaster without its IRK
Date: Sun, 22 Nov 2026 21:13:33 +0100	[thread overview]
Message-ID: <20261122201333.2853192-1-simon.mikuda@streamunlimited.com> (raw)

hci_le_pa_create_sync() waits for an extended advertising report of the
broadcaster to learn its SID, and while HCI_PA_SYNC is set the passive
scan filters on an accept list that holds only the broadcaster's
address. hci_update_accept_list_sync() then enables address resolution
as for any other accept list. A broadcaster that advertises from an RPA
nobody has the IRK for cannot be resolved, and a Synaptics controller
drops its reports at that point instead of matching the address as it
is against the accept list. No report reaches the host, and the PA sync
times out although the broadcaster is in range.

Leave address resolution disabled while the accept list holds a PA sync
target that is an RPA the host has no IRK for. Such a broadcaster can
only be found by the address it advertises from anyway. A broadcaster
known by its identity address, which a bonded one is, still needs
resolution and keeps it. Resolution comes back with the next accept
list update.

This needs no quirk, because it costs nothing on a controller that
matches such an RPA as it is. The resolving list cannot resolve the
target, and the accept list drops the reports of every other device
with or without resolution. Nothing else needs resolution in that
window: hci_le_pa_create_sync() holds the cmd_sync queue until the sync
is established or times out, so no LE connection is created, and
le_conn_complete_evt() maps the RPA of an incoming connection to its
identity in the host.

Own advertising is resumed with resolution off. The stack already
advertises that way: hci_pause_addr_resolution() keeps advertising
paused during an active scan while the host uses an RPA, but
hci_stop_discovery_sync() resumes it before the next accept list update
enables resolution again. It works because with privacy the host
programs the set's random address with an RPA from the same local IRK,
and own address type 0x03 falls back to that address when the
controller does not generate one from the resolving list.

Steps to reproduce:
1. On a Synaptics controller with LL privacy support, listen for a
   broadcaster that advertises from an RPA and is not bonded.
2. The PA sync times out with no advertising report of the broadcaster.

Fixes: bba71ef13b20 ("Bluetooth: hci_sync: Use address filtering when HCI_PA_SYNC is set")
Signed-off-by: Simon Mikuda <simon.mikuda@streamunlimited.com>
---
 net/bluetooth/hci_sync.c | 20 +++++++++++++++++---
 1 file changed, 17 insertions(+), 3 deletions(-)

diff --git a/net/bluetooth/hci_sync.c b/net/bluetooth/hci_sync.c
index 638589f77081..1a920cd83df1 100644
--- a/net/bluetooth/hci_sync.c
+++ b/net/bluetooth/hci_sync.c
@@ -3216,6 +3216,7 @@ static u8 hci_update_accept_list_sync(struct hci_dev *hdev)
 	struct conn_params *params;
 	u8 num_entries = 0;
 	bool pend_conn, pend_report;
+	bool resolve = true;
 	u8 filter_policy;
 	size_t i, n;
 	int err;
@@ -3258,6 +3259,16 @@ static u8 hci_update_accept_list_sync(struct hci_dev *hdev)
 
 			rcu_read_unlock();
 
+			/* With address resolution enabled, a controller may
+			 * drop the advertising reports of an RPA it has no IRK
+			 * for instead of matching the address as it is against
+			 * the accept list. The SID the PA sync waits for then
+			 * never arrives. Match a broadcaster without an IRK by
+			 * the address it advertises from.
+			 */
+			resolve = !hci_bdaddr_is_rpa(&pa.addr, pa.addr_type) ||
+				  hci_find_irk_by_rpa(hdev, &pa.addr);
+
 			/* Clear first since there could be addresses left
 			 * behind.
 			 */
@@ -3383,9 +3394,12 @@ static u8 hci_update_accept_list_sync(struct hci_dev *hdev)
 	filter_policy = err ? 0x00 : 0x01;
 
 	/* Enable address resolution when LL Privacy is enabled. */
-	err = hci_le_set_addr_resolution_enable_sync(hdev, 0x01);
-	if (err)
-		bt_dev_err(hdev, "Unable to enable LL privacy: %d", err);
+	if (resolve) {
+		err = hci_le_set_addr_resolution_enable_sync(hdev, 0x01);
+		if (err)
+			bt_dev_err(hdev, "Unable to enable LL privacy: %d",
+				   err);
+	}
 
 	/* Resume advertising if it was paused */
 	if (ll_privacy_capable(hdev))

base-commit: 4fe38719e6738feaa90486e36b0790dd5d960a96
-- 
2.43.0


             reply	other threads:[~2026-11-22 20:13 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-22 20:13 Simon Mikuda [this message]
2026-11-22 22:50 ` Bluetooth: hci_sync: Sync to an RPA broadcaster without its IRK 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=20261122201333.2853192-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