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

Commit a08f3ffa authored by Łukasz Rymanowski's avatar Łukasz Rymanowski Committed by Jakub Pawlowski
Browse files

eatt: Fix crash on double disconnect

Bug: 159786353
Tag: #feature
Test: atest --host net_test_eatt
Sponsor: jpawlowski@

Change-Id: Ie4872f1c51445df59f2f68b127454d5f4d4e9ad0
parent 38ea762d
Loading
Loading
Loading
Loading
+10 −1
Original line number Diff line number Diff line
@@ -582,7 +582,16 @@ struct eatt_impl {
    LOG(INFO) << __func__ << " " << bd_addr;

    eatt_device* eatt_dev = find_device_by_address(bd_addr);
    if (!eatt_dev) return;
    if (!eatt_dev) {
      LOG(WARNING) << __func__ << " no eatt device found";
      return;
    }

    if (!eatt_dev->eatt_tcb_) {
      LOG_ASSERT(eatt_dev->eatt_channels.size() == 0);
      LOG(WARNING) << __func__ << " no eatt channels found";
      return;
    }

    auto iter = eatt_dev->eatt_channels.begin();
    while (iter != eatt_dev->eatt_channels.end()) {
+8 −0
Original line number Diff line number Diff line
@@ -370,4 +370,12 @@ TEST_F(EattTest, ReconfigPeerFailed) {

  DisconnectEattDevice();
}

TEST_F(EattTest, DoubleDisconnect) {
  ConnectDeviceEattSupported(1);
  DisconnectEattDevice();

  /* Force second disconnect */
  eatt_instance_->Disconnect(test_address);
}
}  // namespace