Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
host/ble_l2cap_coc: fix possible race condition in L2CAP COC
Two functions: `ble_l2cap_coc_continue_tx` and `ble_l2cap_coc_recv_ready` can be reached from other task than host, for example separate thread running in application, by calling `ble_l2cap_recv_ready` or `ble_l2cap_send`. Because pointer to chan passed into these functions may be outdated (connection is being terminated by host) this will lead to either: - triggering BLE_HS_DBG_ASSERT(conn != NULL) in ble_hs_conn_find_assert - dereferencing NULL pointer to conn, after ble_hs_conn_find_assert returns NULL (case with disabled BLE_HS_DEBUG) These two cases shall not cause assert, and should be prepared for chan not existing anymore. Now, BLE_HS_ENOTCONN is returned if connection no longer exists.
- Loading branch information