From 61606a6f95da8e291fe6d55ea8b336467626e69b Mon Sep 17 00:00:00 2001 From: zhanghaipeng Date: Tue, 22 Jul 2025 21:20:17 +0800 Subject: [PATCH] fix(ble/bluedroid): ensure resolving list is updated when the oldest device is removed --- components/bt/host/bluedroid/stack/btm/btm_dev.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/components/bt/host/bluedroid/stack/btm/btm_dev.c b/components/bt/host/bluedroid/stack/btm/btm_dev.c index c4eb88a004..7e1095f4a5 100644 --- a/components/bt/host/bluedroid/stack/btm/btm_dev.c +++ b/components/bt/host/bluedroid/stack/btm/btm_dev.c @@ -368,6 +368,12 @@ tBTM_SEC_DEV_REC *btm_sec_alloc_dev (BD_ADDR bd_addr) } if (!new_entry_found) { p_dev_rec = btm_find_oldest_dev(); +#if (BLE_INCLUDED == TRUE) && (SMP_INCLUDED == TRUE) + // If device record exists and contains identity key, remove it from resolving list + if (p_dev_rec && (p_dev_rec->ble.key_type & SMP_SEC_KEY_TYPE_ID)) { + btm_ble_resolving_list_remove_dev(p_dev_rec); + } +#endif // (BLE_INCLUDED == TRUE) && (SMP_INCLUDED == TRUE) } else { /* if the old device entry not present go with new entry */ if (old_entry_found) {