OSDN Git Service

GD SMC: Only call Hold for outgoing Link
authorMartin Brabham <optedoblivion@google.com>
Thu, 10 Sep 2020 20:28:05 +0000 (13:28 -0700)
committerMartin Brabham <optedoblivion@google.com>
Mon, 14 Sep 2020 19:29:47 +0000 (12:29 -0700)
If we get a call for an incoming Link we do
not want to hold unless we want to do something with it.

Holding incoming connections can result in never Releasing

Bug: 162984360
Tag: #gd-refactor
Test: cert/run --host SecurityTest
Change-Id: I6607c79e7b3af77334fcc871c0bfe31406050978

gd/security/channel/security_manager_channel.cc

index 5b26046..48580ab 100644 (file)
@@ -88,9 +88,9 @@ void SecurityManagerChannel::OnHciEventReceived(hci::EventPacketView packet) {
 
 void SecurityManagerChannel::OnLinkConnected(std::unique_ptr<l2cap::classic::LinkSecurityInterface> link) {
   // Multiple links possible?
-  link->Hold();
   auto remote = link->GetRemoteAddress();
   if (outgoing_pairing_remote_devices_.count(remote) == 1) {
+    link->Hold();
     link->EnsureAuthenticated();
     outgoing_pairing_remote_devices_.erase(remote);
   }