From: Yang Li <yang.li@xxxxxxxxxxx> Add BT_BAP_STREAM_STATE_CONFIG state check so that stream_disable() is a no-op when the stream is in CONFIG state. This prevents unexpected state transitions or redundant operations during cleanup. Error trace: bluetoothd[2313]: src/shared/bap.c:stream_io_disconnected() stream 0x1f9fc20 io disconnected bluetoothd[2313]: src/shared/bap.c:bap_ucast_set_state() stream 0x1f9fc20 dir 0x01: releasing -> config bluetoothd[2313]: src/shared/bap.c:stream_notify() stream 0x1f9fc20 state 1 bluetoothd[2313]: profiles/audio/transport.c:bap_state_changed() stream 0x1f9fc20: releasing(6) -> config(1) ... bluetoothd[2313]: src/shared/bap.c:stream_disable() stream 0x1f9fc20 bluetoothd[2313]: src/shared/bap.c:bap_ucast_set_state() stream 0x1f9fc20 dir 0x01: config -> qos Signed-off-by: Yang Li <yang.li@xxxxxxxxxxx> --- Changes in v4: - Optimizing the code and update the commit message - Link to v3: https://patch.msgid.link/20250702-bap_for_big_sync_lost-v3-1-d314b60abf7a@xxxxxxxxxxx Changes in v3: - Optimizing the code - Link to v2: https://patch.msgid.link/20250630-bap_for_big_sync_lost-v2-0-1491b608cda5@xxxxxxxxxxx bap for big sync lost To: Linux Bluetooth <linux-bluetooth@xxxxxxxxxxxxxxx> Signed-off-by: Yang Li <yang.li@xxxxxxxxxxx> Changes in v2: - Add state check in stream_disable. - Add type check in stream_io_disconnected. - Link to v1: https://patch.msgid.link/20250624-bap_for_big_sync_lost-v1-1-0df90a0f55d0@xxxxxxxxxxx --- src/shared/bap.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/shared/bap.c b/src/shared/bap.c index 40e1c974b..2d4f003c7 100644 --- a/src/shared/bap.c +++ b/src/shared/bap.c @@ -2124,6 +2124,7 @@ static unsigned int bap_ucast_start(struct bt_bap_stream *stream, static uint8_t stream_disable(struct bt_bap_stream *stream, struct iovec *rsp) { if (!stream || stream->ep->state == BT_BAP_STREAM_STATE_QOS || + stream->ep->state == BT_BAP_STREAM_STATE_CONFIG || stream->ep->state == BT_BAP_STREAM_STATE_IDLE) return 0; --- base-commit: 55a6763cde8a2309fd23a96479ee4cf2fc23a442 change-id: 20250624-bap_for_big_sync_lost-63476c679dbb Best regards, -- Yang Li <yang.li@xxxxxxxxxxx>