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

Commit ced09db0 authored by Abhishek Pandit-Subedi's avatar Abhishek Pandit-Subedi
Browse files

floss: Drop Connect Complete with bad handle

Some controllers are returning a Connect Complete with an invalid handle
when SCO connections fail rather than returning a SCO Connect Complete.
Temporarily drop such packets unilaterally until we have finer grade
control of such asserts by policy.

Bug: 261610529
Tag: #floss
Test: Build and basic test against ChromeOS

Change-Id: I3904ec05c4b105d4340a4b17cac2133d074e475e
parent 75fa79c2
Loading
Loading
Loading
Loading
+22 −0
Original line number Diff line number Diff line
@@ -384,6 +384,28 @@ struct classic_impl : public security::ISecurityManagerListener {
    ASSERT(connection_complete.IsValid());
    auto status = connection_complete.GetStatus();
    auto address = connection_complete.GetBdAddr();

    // TODO(b/261610529) - Some controllers incorrectly return connection
    // failures via HCI Connect Complete instead of SCO connect complete.
    // Temporarily just drop these packets until we have finer grained control
    // over these ASSERTs.
#if TARGET_FLOSS
    auto handle = connection_complete.GetConnectionHandle();
    auto link_type = connection_complete.GetLinkType();

    // HACK: Some failed SCO connections are reporting failures via
    //       ConnectComplete instead of ScoConnectionComplete.
    //       Drop such packets.
    if (handle == 0xffff && link_type == LinkType::SCO) {
      LOG_ERROR(
          "ConnectionComplete with invalid handle(%u), link type(%u) and status(%d). Dropping packet.",
          handle,
          link_type,
          status);
      return;
    }
#endif

    acl_scheduler_->ReportAclConnectionCompletion(
        address,
        handler_->BindOnceOn(