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

Commit 72ded40e authored by Hemant Gupta's avatar Hemant Gupta
Browse files

SMP: Add error status in case of no L2CAP LCB's

Usecase:
1) Pair/Connect DUT with devices until MAX_L2CAP_LINKS is reached
2) Try to pair with new BLE Device.

Expected Result:
Pairing should fail gracefully since MAX_L2CAP_LINKS is reached

Observed Results:
Pairing stuck in repeated loop until BT off and on.

Root Cause:
Callback status is not updated with failure in case of error in
connecting L2CAP Fixed channel during SMP Pair due to unavailability
of LCB(s).

Fix:
Update the error code before sending SMP_AUTH_CMPL_EVT to SMP
state machine.

Test: Above usecase works fine after the change

Bug: 157326526
Change-Id: Idcee8869c4d87d4da98ce2ded95c97034f5f1b5c
parent d54932d2
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -148,6 +148,7 @@ tSMP_STATUS SMP_Pair(const RawAddress& bd_addr) {
    if (!L2CA_ConnectFixedChnl(L2CAP_SMP_CID, bd_addr)) {
      tSMP_INT_DATA smp_int_data;
      smp_int_data.status = SMP_PAIR_INTERNAL_ERR;
      p_cb->status = SMP_PAIR_INTERNAL_ERR;
      SMP_TRACE_ERROR("%s: L2C connect fixed channel failed.", __func__);
      smp_sm_event(p_cb, SMP_AUTH_CMPL_EVT, &smp_int_data);
      return SMP_PAIR_INTERNAL_ERR;
@@ -192,6 +193,7 @@ tSMP_STATUS SMP_BR_PairWith(const RawAddress& bd_addr) {
    SMP_TRACE_ERROR("%s: L2C connect fixed channel failed.", __func__);
    tSMP_INT_DATA smp_int_data;
    smp_int_data.status = SMP_PAIR_INTERNAL_ERR;
    p_cb->status = SMP_PAIR_INTERNAL_ERR;
    smp_br_state_machine_event(p_cb, SMP_BR_AUTH_CMPL_EVT, &smp_int_data);
    return SMP_PAIR_INTERNAL_ERR;
  }