Skip to content

Commit 94764d1

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 a8ecd94 commit 94764d1

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
@@ -372,6 +372,8 @@ struct bt_conn *bt_conn_new(struct bt_conn *conns, size_t size)
372372
k_work_init_delayable(&conn->deferred_work, deferred_work);
373373
#endif /* CONFIG_BT_CONN */
374374
#if defined(CONFIG_BT_CONN_TX)
375+
__ASSERT(!k_work_is_pending(&conn->tx_complete_work),
376+
"tx_complete_work is pending, performing k_work_init will break the workqueue");
375377
k_work_init(&conn->tx_complete_work, tx_complete_work);
376378
#endif /* CONFIG_BT_CONN_TX */
377379

0 commit comments

Comments
 (0)