Bluetooth: controller: Don't consider CIS connected before established

Make sure ll_iso_stream_connected_get returns NULL until CIS is
established. Always return DISALLOWED when trying to disconnect a CIS
which is not connected.

Signed-off-by: Morten Priess <mtpr@oticon.com>
This commit is contained in:
Morten Priess 2022-09-26 08:52:45 +02:00 committed by Carles Cufí
commit fae2beba9d
2 changed files with 7 additions and 4 deletions

View file

@ -624,12 +624,13 @@ uint8_t ll_terminate_ind_send(uint16_t handle, uint8_t reason)
if (IS_CIS_HANDLE(handle)) {
#if !defined(CONFIG_BT_LL_SW_LLCP_LEGACY)
cis = ll_iso_stream_connected_get(handle);
/* Disallow if CIS is not connected */
if (!cis) {
return BT_HCI_ERR_UNKNOWN_CONN_ID;
return BT_HCI_ERR_CMD_DISALLOWED;
}
conn = ll_connected_get(cis->lll.acl_handle);
/* Is conn still connected? */
/* Disallow if ACL has disconnected */
if (!conn) {
return BT_HCI_ERR_CMD_DISALLOWED;
}

View file

@ -159,8 +159,10 @@ struct ll_conn_iso_stream *ll_iso_stream_connected_get(uint16_t handle)
}
cis = ll_conn_iso_stream_get(handle);
if ((cis->group == NULL) || (cis->lll.handle != handle)) {
/* CIS does not belong to a group or has inconsistent handle */
if ((cis->group == NULL) || (cis->lll.handle != handle) || !cis->established) {
/* CIS does not belong to a group, has inconsistent handle or is
* not yet established.
*/
return NULL;
}