fix(ble/bluedroid): Fixed read or write failed if SMP is disabled

(cherry picked from commit 124f275bdf839b855e6af0cfb9d197f11c9a766c)

Co-authored-by: zhiweijian <zhiweijian@espressif.com>
This commit is contained in:
Zhi Wei Jian
2026-03-02 10:04:19 +08:00
parent 901d054301
commit 3b5a95b0ae
4 changed files with 3 additions and 14 deletions
@@ -1044,13 +1044,11 @@ tGATT_STATUS GATTC_Read (UINT16 conn_id, tGATT_READ_TYPE type, tGATT_READ_PARAM
default:
break;
}
#if (SMP_INCLUDED == TRUE)
/* start security check */
if (gatt_security_check_start(p_clcb) == FALSE) {
status = GATT_NO_RESOURCES;
gatt_clcb_dealloc(p_clcb);
}
#endif // (SMP_INCLUDED == TRUE)
} else {
status = GATT_NO_RESOURCES;
}
@@ -1110,11 +1108,9 @@ tGATT_STATUS GATTC_Write (UINT16 conn_id, tGATT_WRITE_TYPE type, tGATT_VALUE *p_
p_clcb->start_offset = p_write->offset;
p->offset = 0;
}
#if (SMP_INCLUDED == TRUE)
if (gatt_security_check_start(p_clcb) == FALSE) {
status = GATT_NO_RESOURCES;
}
#endif // (SMP_INCLUDED == TRUE)
} else {
status = GATT_NO_RESOURCES;
}
@@ -129,8 +129,6 @@ void gatt_verify_signature(tGATT_TCB *p_tcb, BT_HDR *p_buf)
}
#endif ///SMP_INCLUDED == TRUE
#if (SMP_INCLUDED == TRUE)
/*******************************************************************************
**
** Function gatt_sec_check_complete
@@ -158,6 +156,7 @@ void gatt_sec_check_complete(BOOLEAN sec_check_ok, tGATT_CLCB *p_clcb, UINT8 s
}
}
#if (SMP_INCLUDED == TRUE)
/*******************************************************************************
**
** Function gatt_enc_cmpl_cback
@@ -256,7 +255,7 @@ void gatt_notify_enc_cmpl(BD_ADDR bd_addr)
}
return;
}
#endif // (SMP_INCLUDED == TRUE)
/*******************************************************************************
**
** Function gatt_set_sec_act
@@ -290,7 +289,7 @@ tGATT_SEC_ACTION gatt_get_sec_act(tGATT_TCB *p_tcb)
}
return sec_act;
}
#endif // (SMP_INCLUDED == TRUE)
/*******************************************************************************
**
** Function gatt_determine_sec_act
@@ -426,7 +425,6 @@ tGATT_STATUS gatt_get_link_encrypt_status(tGATT_TCB *p_tcb)
return encrypt_status ;
}
#if (SMP_INCLUDED == TRUE)
/*******************************************************************************
**
** Function gatt_convert_sec_action
@@ -524,6 +522,5 @@ BOOLEAN gatt_security_check_start(tGATT_CLCB *p_clcb)
return status;
}
#endif // (SMP_INCLUDED == TRUE)
#endif /* BLE_INCLUDED */
@@ -2807,7 +2807,6 @@ BOOLEAN gatt_update_auto_connect_dev (tGATT_IF gatt_if, BOOLEAN add, BD_ADDR bd_
}
#endif // #if (GATT_BG_CONN_DEV == TRUE)
#if (SMP_INCLUDED == TRUE)
/*******************************************************************************
**
** Function gatt_add_pending_new_srv_start
@@ -2829,7 +2828,6 @@ tGATT_PENDING_ENC_CLCB *gatt_add_pending_enc_channel_clcb(tGATT_TCB *p_tcb, tGAT
}
return p_buf;
}
#endif // (SMP_INCLUDED == TRUE)
char *gatt_uuid_to_str(const tBT_UUID *uuid)
{
@@ -376,10 +376,8 @@ typedef struct{
}tGATT_PREPARE_WRITE_RECORD;
typedef struct {
#if (SMP_INCLUDED == TRUE)
fixed_queue_t *pending_enc_clcb; /* pending encryption channel q */
tGATT_SEC_ACTION sec_act;
#endif // (SMP_INCLUDED == TRUE)
BD_ADDR peer_bda;
tBT_TRANSPORT transport;