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

Commit 01b9c118 authored by Venkata Jagadeesh Garaga's avatar Venkata Jagadeesh Garaga Committed by William Escande
Browse files

SDP: Handle race condition in HID SDP

Handle race condition in HID SDP with sdp
serialization. As HID triggers next sdp connection
from sdp call back, next sdp added to sdp pending queue
but never get triggered.

Hence trigger call back and then process pending
sdp ccbs

Merged-In: Ib1a16aba344752da3c0082611b9a69f485f93df1
Change-Id: Ib1a16aba344752da3c0082611b9a69f485f93df1
CRs-Fixed: 2114915
Bug: 246022810
Test: atest net_test_stack_sdp
Tag: #feature
(cherry picked from commit 9272e86f)
parent 8baba338
Loading
Loading
Loading
Loading
+12 −13
Original line number Diff line number Diff line
@@ -257,17 +257,6 @@ static void sdp_disconnect_ind(uint16_t l2cap_cid, bool ack_needed) {
    return;
  }

  if (ack_needed) {
    sdpu_process_pend_ccb(p_ccb->connection_id, false);
  } else {
    SDP_TRACE_WARNING(
        "SDP - Rcvd L2CAP disc, "
        "ACL disc clear pend sdp ccb: 0x%x",
        l2cap_cid);
    sdpu_clear_pend_ccb(p_ccb->connection_id);
  }

  SDP_TRACE_EVENT("SDP - Rcvd L2CAP disc, CID: 0x%x", l2cap_cid);
  /* Tell the user if there is a callback */
  if (p_ccb->p_cb)
    (*p_ccb->p_cb)(((p_ccb->con_state == SDP_STATE_CONNECTED)
@@ -279,6 +268,16 @@ static void sdp_disconnect_ind(uint16_t l2cap_cid, bool ack_needed) {
                                                   : SDP_CONN_FAILED),
        p_ccb->user_data);

  if (ack_needed) {
    SDP_TRACE_WARNING("SDP - Rcvd L2CAP disc, process pend sdp ccb: 0x%x",
                      l2cap_cid);
    sdpu_process_pend_ccb(p_ccb->connection_id, false);
  } else {
    SDP_TRACE_WARNING("SDP - Rcvd L2CAP disc, clear pend sdp ccb: 0x%x",
                      l2cap_cid);
    sdpu_clear_pend_ccb(p_ccb->connection_id);
  }

  sdpu_release_ccb(p_ccb);
}

@@ -444,7 +443,6 @@ static void sdp_disconnect_cfm(uint16_t l2cap_cid,

  SDP_TRACE_EVENT("SDP - Rcvd L2CAP disc cfm, CID: 0x%x", l2cap_cid);

  sdpu_process_pend_ccb(p_ccb->connection_id, false);
  /* Tell the user if there is a callback */
  if (p_ccb->p_cb)
    (*p_ccb->p_cb)(static_cast<tSDP_STATUS>(p_ccb->disconnect_reason));
@@ -452,6 +450,7 @@ static void sdp_disconnect_cfm(uint16_t l2cap_cid,
    (*p_ccb->p_cb2)(static_cast<tSDP_STATUS>(p_ccb->disconnect_reason),
                    p_ccb->user_data);

  sdpu_process_pend_ccb(p_ccb->connection_id, false);
  sdpu_release_ccb(p_ccb);
}

@@ -472,12 +471,12 @@ void sdp_conn_timer_timeout(void* data) {
                  p_ccb->connection_id);

  L2CA_DisconnectReq(p_ccb->connection_id);
  sdpu_clear_pend_ccb(p_ccb->connection_id);

  /* Tell the user if there is a callback */
  if (p_ccb->p_cb)
    (*p_ccb->p_cb)(SDP_CONN_FAILED);
  else if (p_ccb->p_cb2)
    (*p_ccb->p_cb2)(SDP_CONN_FAILED, p_ccb->user_data);
  sdpu_clear_pend_ccb(p_ccb->connection_id);
  sdpu_release_ccb(p_ccb);
}