From: Jakub Pawlowski Date: Tue, 29 May 2018 22:28:15 +0000 (-0700) Subject: LE Create Connection Complete - crash on Command Disallowed X-Git-Tag: android-x86-9.0-r1~70^2~1^2 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=bd58b0bb9c4ae21331bc2fd9fbc443efe880ee53;p=android-x86%2Fsystem-bt.git LE Create Connection Complete - crash on Command Disallowed When LE Create Connection Complete is received with status "Command Disallowed", we can't tell which state we should transition to. This can be triggered only in case of rare race condition. Crash to recover. This was introduced in 24adb37e4106bf8544c7729d34451fdf2777c4dc, when generic handling of all errors to this event was added. Bug: 77429706 Test: sl4a GattConnectTest Change-Id: I888861461da296876d97e8784a3dc7c53130fb51 (cherry picked from commit 60a7c428a2533349f39bca50289046e7846c15a5) --- diff --git a/stack/btm/btm_ble.cc b/stack/btm/btm_ble.cc index 9edfebb1a..ca93e1a5d 100644 --- a/stack/btm/btm_ble.cc +++ b/stack/btm/btm_ble.cc @@ -2016,9 +2016,20 @@ void btm_ble_conn_complete(uint8_t* p, UNUSED_ATTR uint16_t evt_len, * *****************************************************************************/ void btm_ble_create_ll_conn_complete(uint8_t status) { - if (status != HCI_SUCCESS) { - btm_ble_set_conn_st(BLE_CONN_IDLE); - btm_ble_update_mode_operation(HCI_ROLE_UNKNOWN, NULL, status); + if (status == HCI_SUCCESS) return; + + btm_ble_set_conn_st(BLE_CONN_IDLE); + btm_ble_update_mode_operation(HCI_ROLE_UNKNOWN, NULL, status); + + LOG(WARNING) << "LE Create Connection attempt failed, status=" + << loghex(status); + + if (status == HCI_ERR_COMMAND_DISALLOWED) { + /* There is already either direct connect, or whitelist connection + * pending, but we don't know which one, or to which state should we + * transition now. This can be triggered only in case of rare race + * condition. Crash to recover. */ + LOG(FATAL) << "LE Create Connection - command disallowed"; } } /*****************************************************************************