From 0fa5f59d2b894e6d6c05b9f1a4ee76775df6b632 Mon Sep 17 00:00:00 2001 From: Zhang Hai Peng Date: Fri, 25 Jul 2025 21:53:23 +0800 Subject: [PATCH] fix(ble/bluedroid): Fixed fail to disconnect when device record is cleared (cherry picked from commit b6dc79af47f7a1fbed0e1193666a5470871344bb) Co-authored-by: zhanghaipeng --- components/bt/host/bluedroid/stack/btm/btm_acl.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/components/bt/host/bluedroid/stack/btm/btm_acl.c b/components/bt/host/bluedroid/stack/btm/btm_acl.c index 7a0a3932a8..f540fe9553 100644 --- a/components/bt/host/bluedroid/stack/btm/btm_acl.c +++ b/components/bt/host/bluedroid/stack/btm/btm_acl.c @@ -2409,8 +2409,7 @@ tBTM_STATUS btm_remove_acl (BD_ADDR bd_addr, tBT_TRANSPORT transport) } else /* otherwise can disconnect right away */ #endif { - if (hci_handle != 0xFFFF && p_dev_rec && - p_dev_rec->sec_state != BTM_SEC_STATE_DISCONNECTING) { + if (hci_handle != 0xFFFF && (( p_dev_rec && p_dev_rec->sec_state != BTM_SEC_STATE_DISCONNECTING) || (!p_dev_rec))) { if (!btsnd_hcic_disconnect (hci_handle, HCI_ERR_PEER_USER)) { status = BTM_NO_RESOURCES; }