From 168377c0c8e8d36ba291e3cef5fe5185d7ef0be2 Mon Sep 17 00:00:00 2001 From: Yang Li Date: Mon, 7 Jul 2025 14:00:36 +0800 Subject: [PATCH] shared/bap: Add stream state check in stream_disable 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 --- 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; -- 2.47.3