[PATCH BlueZ v5 1/3] shared/bap: Skip local metadata Config callbacks
From: dt <hidden>
Date: 2026-09-17 19:12:23
Subsystem:
the rest · Maintainer:
Linus Torvalds
From: Derek Tern <redacted>
When reconfiguring a client stream that is already Codec Configured,
setup_config() queues Codec Configuration and then caches metadata.
stream_metadata() emits a same-state CONFIG notification for that local
update. The profile callback treats it as the peer's configuration
completion and clears config_pending before the peer has responded.
If the control point response precedes the ASE state notification, QoS
setup can run while need_reconfig is still set and fail locally.
Cache client metadata in CONFIG without emitting a state notification.
Keep genuine peer CONFIG notifications and server metadata handling
unchanged.
---
I tried a custom preset with Media metadata. endpoint.config succeeded,
but the transport metadata was empty: cmd_config_endpoint() does not
copy preset->meta. Patch 2 fixes that; patch 3 now uses custom presets.
v5: Use an equivalent early return to remove the fallthrough warning.
Forward preset metadata and test through endpoint.config. Both
MTU64 cases pass; without the BAP fix, Media fails at premature QoS.
The CI device_addr_type_cmp teardown crash also reproduces on unmodified
f87a79667 with ASan/UBSan. I have not reproduced the separate CIG stack.
src/shared/bap.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/src/shared/bap.c b/src/shared/bap.c
index 891a2f4fd..536d47161 100644
--- a/src/shared/bap.c
+++ b/src/shared/bap.c@@ -2278,6 +2278,11 @@ static uint8_t stream_metadata(struct bt_bap_stream *stream, struct iovec *meta, util_iov_free(stream->meta, 1); stream->meta = util_iov_dup(meta, 1); + /* Local client metadata does not confirm the peer config. */ + if (stream->client && bt_bap_stream_get_state(stream) == + BT_BAP_STREAM_STATE_CONFIG) + return 0; + switch (bt_bap_stream_get_state(stream)) { case BT_BAP_STREAM_STATE_IDLE: /* Initial metadata */
--
2.55.0