diff options
Diffstat (limited to 'stack/btu/btu_hcif.cc')
-rw-r--r-- | stack/btu/btu_hcif.cc | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/stack/btu/btu_hcif.cc b/stack/btu/btu_hcif.cc index fbd769510..b5243cdca 100644 --- a/stack/btu/btu_hcif.cc +++ b/stack/btu/btu_hcif.cc @@ -733,6 +733,14 @@ static void read_encryption_key_size_complete_after_encryption_change( << std::to_string(key_size); } + if (status == HCI_ERR_INSUFFCIENT_SECURITY) { + /* If remote device stop the encryption before we call "Read Encryption Key + * Size", we might receive Insufficient Security, which means that link is + * no longer encrypted. */ + LOG(INFO) << __func__ << ": encryption stopped on link: " << loghex(handle); + return; + } + if (status != HCI_SUCCESS) { LOG(INFO) << __func__ << ": disconnecting, status: " << loghex(status); btsnd_hcic_disconnect(handle, HCI_ERR_PEER_USER); @@ -1694,6 +1702,14 @@ static void read_encryption_key_size_complete_after_key_refresh( << std::to_string(key_size); } + if (status == HCI_ERR_INSUFFCIENT_SECURITY) { + /* If remote device stop the encryption before we call "Read Encryption Key + * Size", we might receive Insufficient Security, which means that link is + * no longer encrypted. */ + LOG(INFO) << __func__ << ": encryption stopped on link: " << loghex(handle); + return; + } + if (status != HCI_SUCCESS) { LOG(INFO) << __func__ << ": disconnecting, status: " << loghex(status); btsnd_hcic_disconnect(handle, HCI_ERR_PEER_USER); |