Skip to content

Commit 767c4d7

Browse files
committed
Bluetooth: ISO: Fix issue with BIS tx_complete
BIS termination as broadcaster is handled different than ACL and CIS, and in rare chances the tx_complete for BIS may not have been completed in the system workqueue before iso_new was called for the same bt_conn struct (e.g. via bt_iso_cig_create), which would perform k_work_init(&conn->tx_complete_work, tx_complete_work); but where conn->tx_complete_work still existed in the system workqueue, which would cause the list of pending items on the system workqueue to be removed as the `next` pointer would be NULL. This also adds an assert in bt_conn_new to prevent this issue from appearing again. Signed-off-by: Emil Gydesen <[email protected]>
1 parent c7ccdd6 commit 767c4d7

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

subsys/bluetooth/host/conn.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -381,6 +381,8 @@ struct bt_conn *bt_conn_new(struct bt_conn *conns, size_t size)
381381
k_work_init_delayable(&conn->deferred_work, deferred_work);
382382
#endif /* CONFIG_BT_CONN */
383383
#if defined(CONFIG_BT_CONN_TX)
384+
__ASSERT(!k_work_is_pending(&conn->tx_complete_work),
385+
"tx_complete_work is pending, performing k_work_init will break the workqueue");
384386
k_work_init(&conn->tx_complete_work, tx_complete_work);
385387
#endif /* CONFIG_BT_CONN_TX */
386388

0 commit comments

Comments
 (0)