Skip to content

Commit 0cb7365

Browse files
jhovoldkuba-moo
authored andcommitted
Bluetooth: fix invalid-bdaddr quirk for non-persistent setup
Devices that lack persistent storage for the device address can indicate this by setting the HCI_QUIRK_INVALID_BDADDR which causes the controller to be marked as unconfigured until user space has set a valid address. Once configured, the device address must be set on every setup for controllers with HCI_QUIRK_NON_PERSISTENT_SETUP to avoid marking the controller as unconfigured and requiring the address to be set again. Fixes: 740011c ("Bluetooth: Add new quirk for non-persistent setup settings") Signed-off-by: Johan Hovold <[email protected]> Signed-off-by: Luiz Augusto von Dentz <[email protected]> Signed-off-by: Jakub Kicinski <[email protected]>
1 parent f752a0b commit 0cb7365

File tree

1 file changed

+11
-17
lines changed

1 file changed

+11
-17
lines changed

net/bluetooth/hci_sync.c

Lines changed: 11 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -4626,23 +4626,17 @@ static int hci_dev_setup_sync(struct hci_dev *hdev)
46264626
invalid_bdaddr = test_bit(HCI_QUIRK_INVALID_BDADDR, &hdev->quirks);
46274627

46284628
if (!ret) {
4629-
if (test_bit(HCI_QUIRK_USE_BDADDR_PROPERTY, &hdev->quirks)) {
4630-
if (!bacmp(&hdev->public_addr, BDADDR_ANY))
4631-
hci_dev_get_bd_addr_from_property(hdev);
4632-
4633-
if (bacmp(&hdev->public_addr, BDADDR_ANY) &&
4634-
hdev->set_bdaddr) {
4635-
ret = hdev->set_bdaddr(hdev,
4636-
&hdev->public_addr);
4637-
4638-
/* If setting of the BD_ADDR from the device
4639-
* property succeeds, then treat the address
4640-
* as valid even if the invalid BD_ADDR
4641-
* quirk indicates otherwise.
4642-
*/
4643-
if (!ret)
4644-
invalid_bdaddr = false;
4645-
}
4629+
if (test_bit(HCI_QUIRK_USE_BDADDR_PROPERTY, &hdev->quirks) &&
4630+
!bacmp(&hdev->public_addr, BDADDR_ANY))
4631+
hci_dev_get_bd_addr_from_property(hdev);
4632+
4633+
if ((invalid_bdaddr ||
4634+
test_bit(HCI_QUIRK_USE_BDADDR_PROPERTY, &hdev->quirks)) &&
4635+
bacmp(&hdev->public_addr, BDADDR_ANY) &&
4636+
hdev->set_bdaddr) {
4637+
ret = hdev->set_bdaddr(hdev, &hdev->public_addr);
4638+
if (!ret)
4639+
invalid_bdaddr = false;
46464640
}
46474641
}
46484642

0 commit comments

Comments
 (0)