Re: [PATCH v3] Bluetooth: find an RPA peer's connection parameters by its identity

From: Radek Podgorny

Date: Tue Nov 24 2026 - 04:20:29 EST


Hi Luiz,

On Mon, Nov 9, 2026 at 1:51 PM Luiz Augusto von Dentz wrote:
> Not following the comments on this one, why would we want a duplicate
> entry for the same device? The comment say it is a new entry, but we
> would lookup so both an RPA or identity shall now result in the same
> hci_conn_params entry, so something is off here and we shouldn't
> really need to do conn_params_resolve before lookup because lookup
> itself does it anyway.

You're right that the comment is misleading. No duplicate entry is
made, and "too" was the wrong word.

The resolve in hci_conn_params_add() isn't there for the lookup. It is
there for the bacpy() into params->addr when the lookup misses. Without
it, an entry created from an RPA would be stored under that RPA, and a
later lookup by the identity or by the peer's next RPA would miss it.

So it's the resolve inside the lookup that is redundant there. In v4 I
split the list walk out into __hci_conn_params_lookup(), which doesn't
resolve, and hci_conn_params_add() resolves once and uses the result
both to search and as the new entry's key:

hci_rpa_to_identity(hdev, &addr, &addr_type, &id_addr);

params = __hci_conn_params_lookup(hdev, addr, addr_type);
if (params)
return params;

hci_conn_params_lookup() is hci_rpa_to_identity() followed by
__hci_conn_params_lookup(), so its callers are unchanged.

v4 follows shortly, as a series: this patch is 4/4, and 1-3 fix what
Sashiko found around it.

Thanks,
Radek