From 3ebd5ad0fc0deb68534406e62fe6af4ba0835cb0 Mon Sep 17 00:00:00 2001 From: Zhang Hai Peng Date: Fri, 25 Jul 2025 21:53:18 +0800 Subject: [PATCH] fix(ble/bluedroid): ensure resolving list is updated when the oldest device is removed (cherry picked from commit 61606a6f95da8e291fe6d55ea8b336467626e69b) Co-authored-by: zhanghaipeng --- 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 4e5ff596dd..2a6717a846 100644 --- a/components/bt/host/bluedroid/stack/btm/btm_dev.c +++ b/components/bt/host/bluedroid/stack/btm/btm_dev.c @@ -367,6 +367,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) {