Skip to content

Commit

Permalink
Merge branch 'bugfix/fix_bleqabr23_338' into 'master'
Browse files Browse the repository at this point in the history
Bluedroid: fixed gatt tcb free when disconnecting

See merge request espressif/esp-idf!24497
  • Loading branch information
jack0c committed Jun 30, 2023
2 parents f9bc38f + e748546 commit a272d45
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 0 deletions.
1 change: 1 addition & 0 deletions components/bt/host/bluedroid/stack/include/stack/l2c_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -1240,6 +1240,7 @@ extern BOOLEAN L2CA_CheckIsCongest(UINT16 fixed_cid, BD_ADDR addr);
#define L2CA_DECREASE_BTU_NUM 4
#define L2CA_BUFF_INI 5
#define L2CA_BUFF_DEINIT 6
#define L2CA_BUFF_FREE 7

typedef struct {
UINT16 conn_id;
Expand Down
6 changes: 6 additions & 0 deletions components/bt/host/bluedroid/stack/l2cap/l2c_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -2386,6 +2386,12 @@ void l2ble_update_att_acl_pkt_num(UINT8 type, tl2c_buff_param_t *param)
buff_semaphore = NULL;
break;
}
case L2CA_BUFF_FREE:{
xSemaphoreTake(buff_semaphore, portMAX_DELAY);
// Do nothing
xSemaphoreGive(buff_semaphore);
break;
}
default:
break;
}
Expand Down
6 changes: 6 additions & 0 deletions components/bt/host/bluedroid/stack/l2cap/l2c_utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -1676,6 +1676,12 @@ void l2cu_release_ccb (tL2C_CCB *p_ccb)
if (!p_ccb->in_use) {
return;
}
#if BLE_INCLUDED == TRUE
if (p_lcb->transport == BT_TRANSPORT_LE) {
/* Take samephore to avoid race condition */
l2ble_update_att_acl_pkt_num(L2CA_BUFF_FREE, NULL);
}
#endif
#if (SDP_INCLUDED == TRUE)
if (p_rcb && (p_rcb->psm != p_rcb->real_psm)) {
btm_sec_clr_service_by_psm(p_rcb->psm);
Expand Down

0 comments on commit a272d45

Please sign in to comment.