Skip to content

Commit 6b84935

Browse files
committed
Bluetooth: host: fix assert on CIS disconnect
For the CIS central, by bluetooth specification, the CIS is not torn down on disconnect. This means that CIS and datapath are still present in the controller and that the host may still send data to the controller. This also means that the controller continues to produce number of complete packets events. Signed-off-by: Jan Müller <[email protected]>
1 parent c0a0e6a commit 6b84935

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

subsys/bluetooth/host/hci_core.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -605,6 +605,19 @@ static void hci_num_completed_packets(struct net_buf *buf)
605605
node = sys_slist_get(&conn->tx_pending);
606606

607607
if (!node) {
608+
/* The datapath on CIS links is not torn down on disconnects.
609+
* This means that there might be completed packets events
610+
* from the controller after the diesconnect.
611+
* Ignore them as the buffers are freed already.
612+
*/
613+
if (conn->type == BT_CONN_TYPE_ISO &&
614+
conn->state == BT_CONN_DISCONNECT_COMPLETE) {
615+
LOG_DBG("received num_complete on disconnected ISO channel "
616+
"%u",
617+
handle);
618+
continue;
619+
}
620+
608621
LOG_ERR("packets count mismatch");
609622
__ASSERT_NO_MSG(0);
610623
break;

0 commit comments

Comments
 (0)