* [PATCH] Bluetooth: hci_event: Use the fallback address when no Local RPA
@ 2026-11-27 5:46 Weihong Guan
2026-11-27 13:56 ` bluez.test.bot
0 siblings, 1 reply; 2+ messages in thread
From: Weihong Guan @ 2026-11-27 5:46 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Weihong Guan, Marcel Holtmann, Luiz Augusto von Dentz
With privacy on, a controller doing LL privacy advertises with own
address type 0x03 (0x02 with a public identity): it makes an RPA from the
resolving list's local IRK if it has an entry to match, and falls back to
the random address (the public address) otherwise. Its LE Enhanced
Connection Complete then gives the Local RPA when it made one, and zeros
when it fell back.
As peripheral, le_conn_update_addr() takes the random address only for
own address type 0x01; for 0x03 with no Local RPA it records
hdev->bdaddr as the connection's own address, and type 0x03 with it.
SMP hashes both into its checks (resp_addr, resp_addr_type), while the
central used the random address the advertising came from, type 0x01:
pairing fails, Secure Connections with "DHKey check failed" (0x0b). It
does whenever the controller falls back, as it does for undirected
advertising with no resolving list entry for the advertising's peer
address.
Take the address the controller fell back to, by type: the random
address for 0x03, the public address for 0x02. The advertising set
terminated event, which fills in an extended advertising set's random
address, checks the same type.
Fixes: cafae4cd6255 ("Bluetooth: Fix handling of LE Enhanced Connection Complete")
Assisted-by: Claude:claude-opus-5.5
Signed-off-by: Weihong Guan <weihong.guan@gmail.com>
---
How it was found and tested: on a Raspberry Pi 5 running 7.4-rc2 with
net/bluetooth from bluetooth-next, bluetoothd stopped. The peripheral: an
nRF52840 dongle with Zephyr's hci_usb (LL privacy, legacy advertising
only), privacy on (btmgmt privacy on, add-adv -c -g): Linux advertises
with own address type 0x03 from the RPA it sets as the random address;
the controller has no resolving list entry for the advertising's peer
address, so it falls back to that address, and LE Enhanced Connection
Complete gives a Local RPA of zeros. The central: another nRF52840 dongle,
or a WCH CH583 running our open HCI controller firmware.
Steps: btmgmt pair -c 3 -t 2 <the peripheral's RPA> (Secure Connections,
Just Works, both confirmations answered over the management socket).
Without this patch: pairing failed in every run, 7 of 7 (CH583 central
four times, nRF52840 three); in each trace read, the peripheral answered
the central's DHKey Check with Pairing Failed, DHKey check failed (0x0b).
With it: paired, 4 of 4 (nRF52840 central three times, CH583 once). With the
peripheral's privacy off, paired with and without.
Only legacy advertising was run: this controller has no extended
advertising, so the advertising set terminated change is by reading.
net/bluetooth/hci_event.c | 19 ++++++++++++++++---
1 file changed, 16 insertions(+), 3 deletions(-)
diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c
index a9b6a6cca..6c1d18ea4 100644
--- a/net/bluetooth/hci_event.c
+++ b/net/bluetooth/hci_event.c
@@ -6323,14 +6323,27 @@ static void le_conn_update_addr(struct hci_conn *conn, bdaddr_t *bdaddr,
&conn->init_addr_type);
}
} else {
- conn->resp_addr_type = conn->hdev->adv_addr_type;
+ /* With own address type 0x02 or 0x03 and no Local RPA, the
+ * controller had no RPA of its own to use and fell back to the
+ * public address (0x02) or the random address (0x03).
+ */
+ switch (conn->hdev->adv_addr_type) {
+ case ADDR_LE_DEV_PUBLIC_RESOLVED:
+ conn->resp_addr_type = ADDR_LE_DEV_PUBLIC;
+ break;
+ case ADDR_LE_DEV_RANDOM_RESOLVED:
+ conn->resp_addr_type = ADDR_LE_DEV_RANDOM;
+ break;
+ default:
+ conn->resp_addr_type = conn->hdev->adv_addr_type;
+ }
/* Check if the controller has set a Local RPA then it must be
* used instead or hdev->rpa.
*/
if (local_rpa && bacmp(local_rpa, BDADDR_ANY)) {
conn->resp_addr_type = ADDR_LE_DEV_RANDOM;
bacpy(&conn->resp_addr, local_rpa);
- } else if (conn->hdev->adv_addr_type == ADDR_LE_DEV_RANDOM) {
+ } else if (conn->resp_addr_type == ADDR_LE_DEV_RANDOM) {
/* In case of ext adv, resp_addr will be updated in
* Adv Terminated event.
*/
@@ -6707,7 +6720,7 @@ static void hci_le_ext_adv_term_evt(struct hci_dev *hdev, void *data,
*/
conn->adv_instance = adv ? adv->instance : ev->handle;
- if (hdev->adv_addr_type != ADDR_LE_DEV_RANDOM ||
+ if (conn->resp_addr_type != ADDR_LE_DEV_RANDOM ||
bacmp(&conn->resp_addr, BDADDR_ANY))
goto unlock;
--
2.47.3
^ permalink raw reply related [flat|nested] 2+ messages in thread
* RE: Bluetooth: hci_event: Use the fallback address when no Local RPA
2026-11-27 5:46 [PATCH] Bluetooth: hci_event: Use the fallback address when no Local RPA Weihong Guan
@ 2026-11-27 13:56 ` bluez.test.bot
0 siblings, 0 replies; 2+ messages in thread
From: bluez.test.bot @ 2026-11-27 13:56 UTC (permalink / raw)
To: linux-bluetooth, weihong.guan
[-- Attachment #1: Type: text/plain, Size: 2652 bytes --]
This is automated email and please do not reply to this email!
Dear submitter,
Thank you for submitting the patches to the linux bluetooth mailing list.
This is a CI test results with your patch series:
PW Link:https://patchwork.kernel.org/series/1223970/
---Test result---
Test Summary:
CheckPatch FAIL 0.39 seconds
VerifyFixes PASS 0.04 seconds
VerifySignedoff PASS 0.04 seconds
GitLint PASS 0.15 seconds
SubjectPrefix PASS 0.04 seconds
BuildKernel PASS 20.45 seconds
CheckAllWarning PASS 23.48 seconds
CheckSparse WARNING 24.71 seconds
BuildKernel32 PASS 20.66 seconds
CheckKernelLLVM PASS 22.41 seconds
TestRunnerSetup PASS 487.25 seconds
TestRunner_l2cap-tester PASS 14.24 seconds
TestRunner_iso-tester PASS 15.83 seconds
TestRunner_bnep-tester PASS 3.13 seconds
TestRunner_mgmt-tester PASS 85.12 seconds
TestRunner_rfcomm-tester PASS 4.37 seconds
TestRunner_sco-tester PASS 5.43 seconds
TestRunner_ioctl-tester PASS 4.49 seconds
TestRunner_mesh-tester PASS 4.43 seconds
TestRunner_smp-tester PASS 6.33 seconds
TestRunner_userchan-tester PASS 3.17 seconds
TestRunner_6lowpan-tester PASS 4.35 seconds
IncrementalBuild PASS 19.48 seconds
Details
##############################
Test: CheckPatch - FAIL
Desc: Run checkpatch.pl script
Output:
Bluetooth: hci_event: Use the fallback address when no Local RPA
WARNING: Non-standard signature: Assisted-by:
#140:
Assisted-by: Claude:claude-opus-5.5
ERROR: Unrecognized email address: 'Claude:claude-opus-5.5'
#140:
Assisted-by: Claude:claude-opus-5.5
total: 1 errors, 1 warnings, 0 checks, 37 lines checked
NOTE: For some of the reported defects, checkpatch may be able to
mechanically convert to the typical style using --fix or --fix-inplace.
/home/runner/work/bluetooth-next/bluetooth-next/src/patch/15028061.patch has style problems, please review.
NOTE: Ignored message types: UNKNOWN_COMMIT_ID
NOTE: If any of the errors are false positives, please report
them to the maintainer, see CHECKPATCH in MAINTAINERS.
##############################
Test: CheckSparse - WARNING
Desc: Run sparse tool with linux kernel
Output:
net/bluetooth/hci_event.c: note: in included file (through include/net/bluetooth/hci_core.h):
https://github.com/bluez/bluetooth-next/pull/1239
---
Regards,
Linux Bluetooth
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-11-27 13:56 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-27 5:46 [PATCH] Bluetooth: hci_event: Use the fallback address when no Local RPA Weihong Guan
2026-11-27 13:56 ` bluez.test.bot
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox