Skip to content

Commit 8935053

Browse files
kirankrishnappa-intelholtmann
authored andcommitted
Bluetooth: btintel: Fix bdaddress comparison with garbage value
Intel Read Verision(TLV) data is parsed into a local structure variable and it contains a field for bd address. Bd address is returned only in bootloader mode and hence bd address in TLV structure needs to be validated only if controller is present in boot loader mode. Signed-off-by: Kiran K <[email protected]> Reviewed-by: Tedd Ho-Jeong An <[email protected]> Signed-off-by: Marcel Holtmann <[email protected]>
1 parent 5a4bb6a commit 8935053

File tree

1 file changed

+14
-8
lines changed

1 file changed

+14
-8
lines changed

drivers/bluetooth/btintel.c

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2081,14 +2081,16 @@ static int btintel_prepare_fw_download_tlv(struct hci_dev *hdev,
20812081
if (ver->img_type == 0x03) {
20822082
btintel_clear_flag(hdev, INTEL_BOOTLOADER);
20832083
btintel_check_bdaddr(hdev);
2084-
}
2085-
2086-
/* If the OTP has no valid Bluetooth device address, then there will
2087-
* also be no valid address for the operational firmware.
2088-
*/
2089-
if (!bacmp(&ver->otp_bd_addr, BDADDR_ANY)) {
2090-
bt_dev_info(hdev, "No device address configured");
2091-
set_bit(HCI_QUIRK_INVALID_BDADDR, &hdev->quirks);
2084+
} else {
2085+
/*
2086+
* Check for valid bd address in boot loader mode. Device
2087+
* will be marked as unconfigured if empty bd address is
2088+
* found.
2089+
*/
2090+
if (!bacmp(&ver->otp_bd_addr, BDADDR_ANY)) {
2091+
bt_dev_info(hdev, "No device address configured");
2092+
set_bit(HCI_QUIRK_INVALID_BDADDR, &hdev->quirks);
2093+
}
20922094
}
20932095

20942096
btintel_get_fw_name_tlv(ver, fwname, sizeof(fwname), "sfi");
@@ -2466,6 +2468,10 @@ static int btintel_setup_combined(struct hci_dev *hdev)
24662468
goto exit_error;
24672469
}
24682470

2471+
/* memset ver_tlv to start with clean state as few fields are exclusive
2472+
* to bootloader mode and are not populated in operational mode
2473+
*/
2474+
memset(&ver_tlv, 0, sizeof(ver_tlv));
24692475
/* For TLV type device, parse the tlv data */
24702476
err = btintel_parse_version_tlv(hdev, &ver_tlv, skb);
24712477
if (err) {

0 commit comments

Comments
 (0)