Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit cb2dcc08 authored by Hansong Zhang's avatar Hansong Zhang
Browse files

Check for control block nullptr on l2cap error

Bug: 159815595
Tag: #refactor
Test: compile & verify basic functions working
Change-Id: Ie041822b2f51aa20e57fa35f90c432a6c96733d5
parent b1c8cb6e
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -103,6 +103,7 @@ void avct_l2c_br_connect_ind_cback(const RawAddress& bd_addr, uint16_t lcid,

void avct_br_on_l2cap_error(uint16_t lcid, uint16_t result) {
  tAVCT_BCB* p_lcb = avct_bcb_by_lcid(lcid);
  if (p_lcb == nullptr) return;

  /* store result value */
  p_lcb->ch_result = result;
+1 −0
Original line number Diff line number Diff line
@@ -137,6 +137,7 @@ static void bnep_connect_ind(const RawAddress& bd_addr, uint16_t l2cap_cid,

static void bnep_on_l2cap_error(uint16_t l2cap_cid, uint16_t result) {
  tBNEP_CONN* p_bcb = bnepu_find_bcb_by_cid(l2cap_cid);
  if (p_bcb == nullptr) return;

  /* Tell the upper layer, if there is a callback */
  if ((p_bcb->con_flags & BNEP_FLAGS_IS_ORIG) && (bnep_cb.p_conn_state_cb)) {
+1 −0
Original line number Diff line number Diff line
@@ -687,6 +687,7 @@ static void gap_sec_check_complete(const RawAddress*, tBT_TRANSPORT,

static void gap_on_l2cap_error(uint16_t l2cap_cid, uint16_t result) {
  tGAP_CCB* p_ccb = gap_find_ccb_by_cid(l2cap_cid);
  if (p_ccb == nullptr) return;

  /* Tell the user if there is a callback */
  if (p_ccb->p_callback)
+1 −0
Original line number Diff line number Diff line
@@ -587,6 +587,7 @@ static void gatt_l2cif_connect_ind_cback(const RawAddress& bd_addr,

static void gatt_on_l2cap_error(uint16_t lcid, uint16_t result) {
  tGATT_TCB* p_tcb = gatt_find_tcb_by_cid(lcid);
  if (p_tcb == nullptr) return;
  if (gatt_get_ch_state(p_tcb) == GATT_CH_CONN) {
    gatt_cleanup_upon_disc(p_tcb->peer_bda, result, BT_TRANSPORT_BR_EDR);
  } else {
+1 −0
Original line number Diff line number Diff line
@@ -556,6 +556,7 @@ static void rfc_mx_send_config_req(tRFC_MCB* p_mcb) {

void rfc_on_l2cap_error(uint16_t lcid, uint16_t result) {
  tRFC_MCB* p_mcb = rfc_find_lcid_mcb(lcid);
  if (p_mcb == nullptr) return;

  if (result == L2CAP_CONN_OTHER_ERROR) {
    RFCOMM_TRACE_DEBUG(
Loading