Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4742b92e authored by Zhengping Jiang's avatar Zhengping Jiang
Browse files

floss: first check privacy mode for resolving list operations

Do not take actions to resolving list if privacy 1.2 is not enabled.
Check address type is valid before adding to resolving list.

Bug: 296896133
Test: mma -j32
Test: restart bluetooth and check log not showing the event
Change-Id: I994802f877611c55fb6e15dc297a6c2813f429ce
parent bd27ec02
Loading
Loading
Loading
Loading
+18 −0
Original line number Diff line number Diff line
@@ -488,6 +488,10 @@ void btm_ble_clear_resolving_list(void) {
 *
 ******************************************************************************/
bool btm_ble_read_resolving_list_entry(tBTM_SEC_DEV_REC* p_dev_rec) {
  if (btm_cb.ble_ctr_cb.privacy_mode < BTM_PRIVACY_1_2) {
    LOG_DEBUG("Privacy 1.2 is not enabled");
    return false;
  }
  if (!(p_dev_rec->ble.in_controller_list & BTM_RESOLVING_LIST_BIT)) {
    LOG_INFO("%s Unable to read resolving list entry as resolving bit not set",
             __func__);
@@ -540,6 +544,10 @@ static bool is_peer_identity_key_valid(const tBTM_SEC_DEV_REC& dev_rec) {
static Octet16 get_local_irk() { return btm_cb.devcb.id_keys.irk; }

void btm_ble_resolving_list_load_dev(tBTM_SEC_DEV_REC& dev_rec) {
  if (btm_cb.ble_ctr_cb.privacy_mode < BTM_PRIVACY_1_2) {
    LOG_DEBUG("Privacy 1.2 is not enabled");
    return;
  }
  if (controller_get_interface()->get_ble_resolving_list_max_size() == 0) {
    LOG_INFO("Controller does not support RPA offloading or privacy 1.2");
    return;
@@ -572,6 +580,12 @@ void btm_ble_resolving_list_load_dev(tBTM_SEC_DEV_REC& dev_rec) {
    };
  }

  if (!is_ble_addr_type_known(dev_rec.ble.identity_address_with_type.type)) {
    LOG_ERROR("Adding unknown address type(%d) to Address Resolving list.",
              dev_rec.ble.identity_address_with_type.type);
    return;
  }

  bluetooth::shim::ACL_AddToAddressResolution(
      dev_rec.ble.identity_address_with_type, peer_irk, local_irk);

@@ -593,6 +607,10 @@ void btm_ble_resolving_list_load_dev(tBTM_SEC_DEV_REC& dev_rec) {
 *
 ******************************************************************************/
void btm_ble_resolving_list_remove_dev(tBTM_SEC_DEV_REC* p_dev_rec) {
  if (btm_cb.ble_ctr_cb.privacy_mode < BTM_PRIVACY_1_2) {
    LOG_DEBUG("Privacy 1.2 is not enabled");
    return;
  }
  BTM_TRACE_EVENT("%s", __func__);

  if ((p_dev_rec->ble.in_controller_list & BTM_RESOLVING_LIST_BIT) &&