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

Commit 265b4973 authored by Jakub Pawlowski's avatar Jakub Pawlowski
Browse files

Fix crash on SDP results

Consider folowing scenario:
1. Trigger SDP
2. Remove device (i.e. due to unbonding)
3. Trigger GATT
4. SDP results arrive -> Crash

With this patch, we would ensure that bta_dm_disc actually awaits SDP
results before parsing them, which could currently cause crash.

Test: mma -j32;
Flag: exempt, trivial
Bug: 354716690
Bug: 349228037
Change-Id: I1ef13f12137a733b9005515d1b23eeaebc1c8119
parent aa575a0b
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -246,9 +246,11 @@ void bta_dm_sdp_finished(RawAddress bda, tBTA_STATUS result, std::vector<bluetoo

/* Callback from sdp with discovery status */
void bta_dm_sdp_callback(const RawAddress& /* bd_addr */, tSDP_STATUS sdp_status) {
  log::info("{}", bta_dm_state_text(bta_dm_discovery_get_state()));
  bool sdp_pending = bta_dm_discovery_cb.transports & BT_TRANSPORT_BR_EDR;
  log::info("{}, sdp_pending: {}", bta_dm_state_text(bta_dm_discovery_get_state()), sdp_pending);

  if (bta_dm_discovery_get_state() == BTA_DM_DISCOVER_IDLE) {
  if (bta_dm_discovery_get_state() == BTA_DM_DISCOVER_IDLE || !sdp_pending ||
      !bta_dm_discovery_cb.sdp_state) {
    return;
  }