Skip to contentSkip to conversation

Bluetooth: qca: check the device address on every setup

PATCH In review Joonhoe Kim 3 participants 3 messages Oct 16 – Oct 19

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Bluetooth: qca: check the device address on every setup

qca_check_bdaddr() sets HCI_QUIRK_USE_BDADDR_PROPERTY when the controller reports the default address from its NVM file, so that the core programs the configured address again on every setup. The check is skipped once hdev->public_addr is set.

If the first setup runs on the ROM firmware because the rampatch and NVM files could not be loaded (driver built in, firmware not in the initramfs), the check is not reached. Once user space sets the address with MGMT_OP_SET_PUBLIC_ADDRESS, every later setup skips it, so the controller falls back to the default address on the next power on and bonded devices no longer connect. Seen with a WCN7850 on a Lenovo Legion Tab Y700 Gen 5.

Check the address on every setup. Setting the quirk while hdev->public_addr is set does not make the controller unconfigured, as is_configured() only looks at it while no address is set.

Fixes 32868e126c78 ("Bluetooth: qca: fix invalid device address check")

---
Tested with the WCN7850 over UART: the configured address survives three power cycles, a bluetoothd restart and an rfkill block/unblock; without this patch the first power cycle reverts it. The NVMEM BD address series [1] changes the same branch; the two apply in either order.

[1] https://lore.kernel.org/all/[email protected]/

 drivers/bluetooth/btqca.c | 3 ---
 1 file changed, 3 deletions(-)
drivers/bluetooth/btqca.c +0 -3
index 22b08ab05b82..756a4a8d5631 100644
@@ -686,9 +686,6 @@ static int qca_check_bdaddr(struct hci_dev *hdev, const struct qca_fw_config *co
 	struct sk_buff *skb;
 	int err;
 
-	if (bacmp(&hdev->public_addr, BDADDR_ANY))
-		return 0;
-
 	skb = __hci_cmd_sync(hdev, HCI_OP_READ_BD_ADDR, 0, NULL,
 			     HCI_INIT_TIMEOUT);
 	if (IS_ERR(skb)) {
Signature · 1 line
2.43.0
#1 lore raw

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/1187309/

---Test result---

Test Summary:

CheckPatch                    PASS      0.91 seconds
VerifyFixes                   PASS      0.10 seconds
VerifySignedoff               PASS      0.14 seconds
GitLint                       PASS      0.27 seconds
SubjectPrefix                 PASS      0.10 seconds
BuildKernel                   PASS      22.21 seconds
CheckAllWarning               PASS      26.11 seconds
CheckSparse                   PASS      27.67 seconds
BuildKernel32                 PASS      22.39 seconds
CheckKernelLLVM               PASS      26.39 seconds
TestRunnerSetup               PASS      517.15 seconds
IncrementalBuild              PASS      21.33 seconds

https://github.com/bluez/bluetooth-next/pull/957

---
Regards,
Linux Bluetooth

maintainer Reviewed-by on v1 1/1
#2 lore raw
In reply to Joonhoe Kim
Quoted 47 lines · Joonhoe Kim

qca_check_bdaddr() sets HCI_QUIRK_USE_BDADDR_PROPERTY when the controller reports the default address from its NVM file, so that the core programs the configured address again on every setup. The check is skipped once hdev->public_addr is set.

If the first setup runs on the ROM firmware because the rampatch and NVM files could not be loaded (driver built in, firmware not in the initramfs), the check is not reached. Once user space sets the address with MGMT_OP_SET_PUBLIC_ADDRESS, every later setup skips it, so the controller falls back to the default address on the next power on and bonded devices no longer connect. Seen with a WCN7850 on a Lenovo Legion Tab Y700 Gen 5.

Check the address on every setup. Setting the quirk while hdev->public_addr is set does not make the controller unconfigured, as is_configured() only looks at it while no address is set.

Fixes 32868e126c78 ("Bluetooth: qca: fix invalid device address check")

---
Tested with the WCN7850 over UART: the configured address survives three power cycles, a bluetoothd restart and an rfkill block/unblock; without this patch the first power cycle reverts it. The NVMEM BD address series [1] changes the same branch; the two apply in either order.

[1] https://lore.kernel.org/all/[email protected]/

 drivers/bluetooth/btqca.c | 3 ---
 1 file changed, 3 deletions(-)
drivers/bluetooth/btqca.c +0 -4
index 22b08ab05b82..756a4a8d5631 100644
@@ -686,9 +686,6 @@ static int qca_check_bdaddr(struct hci_dev *hdev, const struct qca_fw_config *co
 	struct sk_buff *skb;
 	int err;
 
-	if (bacmp(&hdev->public_addr, BDADDR_ANY))
-		return 0;
-
 	skb = __hci_cmd_sync(hdev, HCI_OP_READ_BD_ADDR, 0, NULL,
 			     HCI_INIT_TIMEOUT);
 	if (IS_ERR(skb)) {
--
Quoted 3 lines

2.43.0