Linux bluetooth development
 help / color / mirror / Atom feed
* [PATCH BlueZ] shared/bap: Don't link ucast streams before CIS IDs are assigned
@ 2026-06-09 21:11 Simon Mikuda
  2026-06-09 22:03 ` Pauli Virtanen
  2026-06-09 23:00 ` [BlueZ] shared/bap: Don't link ucast streams before CIS IDs are assigned bluez.test.bot
  0 siblings, 2 replies; 12+ messages in thread
From: Simon Mikuda @ 2026-06-09 21:11 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Simon Mikuda

bap_ucast_io_link pairs streams whose CIG/CIS IDs match, but the IDs
are unset in Codec Configured state, so a Sink and Source bound for
different CISes get linked. The stray link later propagates a
disconnect to the wrong ASE and breaks Receiver Start Ready.

Skip linking until QoS Configured assigns the IDs.

Fixes PTS test BAP/USR/STR/BV-362-C
---
 src/shared/bap.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/src/shared/bap.c b/src/shared/bap.c
index deb85b264..98537de60 100644
--- a/src/shared/bap.c
+++ b/src/shared/bap.c
@@ -2679,6 +2679,12 @@ static int bap_ucast_io_link(struct bt_bap_stream *stream,
 			stream->ep->dir == link->ep->dir)
 		return -EINVAL;
 
+	/* Don't link until QoS Configured assigns the CIS IDs; while unset
+	 * the check above would pair unrelated streams.
+	 */
+	if (!stream->qos.ucast.cis_id || !link->qos.ucast.cis_id)
+		return -EINVAL;
+
 	if (stream->client && !(stream->locked && link->locked))
 		return -EINVAL;
 
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* Re: [PATCH BlueZ] shared/bap: Don't link ucast streams before CIS IDs are assigned
  2026-06-09 21:11 [PATCH BlueZ] shared/bap: Don't link ucast streams before CIS IDs are assigned Simon Mikuda
@ 2026-06-09 22:03 ` Pauli Virtanen
  2026-06-10  7:46   ` Simon Mikuda
  2026-06-09 23:00 ` [BlueZ] shared/bap: Don't link ucast streams before CIS IDs are assigned bluez.test.bot
  1 sibling, 1 reply; 12+ messages in thread
From: Pauli Virtanen @ 2026-06-09 22:03 UTC (permalink / raw)
  To: Simon Mikuda, linux-bluetooth

ti, 2026-06-09 kello 23:11 +0200, Simon Mikuda kirjoitti:
> bap_ucast_io_link pairs streams whose CIG/CIS IDs match, but the IDs
> are unset in Codec Configured state, so a Sink and Source bound for
> different CISes get linked. The stray link later propagates a
> disconnect to the wrong ASE and breaks Receiver Start Ready.
> 
> Skip linking until QoS Configured assigns the IDs.
> 
> Fixes PTS test BAP/USR/STR/BV-362-C
> ---
>  src/shared/bap.c | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/src/shared/bap.c b/src/shared/bap.c
> index deb85b264..98537de60 100644
> --- a/src/shared/bap.c
> +++ b/src/shared/bap.c
> @@ -2679,6 +2679,12 @@ static int bap_ucast_io_link(struct bt_bap_stream *stream,
>  			stream->ep->dir == link->ep->dir)
>  		return -EINVAL;
>  
> +	/* Don't link until QoS Configured assigns the CIS IDs; while unset
> +	 * the check above would pair unrelated streams.
> +	 */
> +	if (!stream->qos.ucast.cis_id || !link->qos.ucast.cis_id)
> +		return -EINVAL;

Zero is valid CIS ID?

> +
>  	if (stream->client && !(stream->locked && link->locked))
>  		return -EINVAL;
>  

-- 
Pauli Virtanen

^ permalink raw reply	[flat|nested] 12+ messages in thread

* RE: [BlueZ] shared/bap: Don't link ucast streams before CIS IDs are assigned
  2026-06-09 21:11 [PATCH BlueZ] shared/bap: Don't link ucast streams before CIS IDs are assigned Simon Mikuda
  2026-06-09 22:03 ` Pauli Virtanen
@ 2026-06-09 23:00 ` bluez.test.bot
  1 sibling, 0 replies; 12+ messages in thread
From: bluez.test.bot @ 2026-06-09 23:00 UTC (permalink / raw)
  To: linux-bluetooth, simon.mikuda

[-- Attachment #1: Type: text/plain, Size: 1600 bytes --]

This is automated email and please do not reply to this email!

Dear submitter,

Thank you for submitting the patches to the linux bluetooth mailing list.
This is a CI test results with your patch series:
PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=1108824

---Test result---

Test Summary:
CheckPatch                    PASS      0.46 seconds
GitLint                       PASS      0.33 seconds
BuildEll                      PASS      20.37 seconds
BluezMake                     PASS      601.20 seconds
MakeCheck                     PASS      12.72 seconds
MakeDistcheck                 PASS      233.39 seconds
CheckValgrind                 PASS      253.37 seconds
CheckSmatch                   WARNING   322.84 seconds
bluezmakeextell               PASS      165.30 seconds
IncrementalBuild              PASS      608.51 seconds
ScanBuild                     PASS      916.87 seconds

Details
##############################
Test: CheckSmatch - WARNING
Desc: Run smatch tool with source
Output:
src/shared/bap.c:317:25: warning: array of flexible structuressrc/shared/bap.c: note: in included file:./src/shared/ascs.h:88:25: warning: array of flexible structuressrc/shared/bap.c:317:25: warning: array of flexible structuressrc/shared/bap.c: note: in included file:./src/shared/ascs.h:88:25: warning: array of flexible structuressrc/shared/bap.c:317:25: warning: array of flexible structuressrc/shared/bap.c: note: in included file:./src/shared/ascs.h:88:25: warning: array of flexible structures


https://github.com/bluez/bluez/pull/2208

---
Regards,
Linux Bluetooth


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH BlueZ] shared/bap: Don't link ucast streams before CIS IDs are assigned
  2026-06-09 22:03 ` Pauli Virtanen
@ 2026-06-10  7:46   ` Simon Mikuda
  2026-06-10 13:06     ` Luiz Augusto von Dentz
                       ` (2 more replies)
  0 siblings, 3 replies; 12+ messages in thread
From: Simon Mikuda @ 2026-06-10  7:46 UTC (permalink / raw)
  To: Pauli Virtanen, linux-bluetooth

I looked into it and 0 is valid ID (probably not used, but still valid).

There is a ugly part in bluez though, when stream is allocated cig and 
cis in qos struct are 0 not 0xff:

stream = new0(struct bt_bap_stream, 1);   /* qos all-zero: cig/cis = 0 */

and also in tests there are some struct comparisons that also use 
cig/cis == 0. Some parts check for 0xff (BT_ISO_QOS_CIG_UNSET, 
BT_ISO_QOS_CIS_UNSET)

Maybe more clean fix would be to hook this up to state, so that when 
CIG/CIS is not at least configured it is rejected e.g.:

if (stream->ep->state < BT_ASCS_ASE_STATE_QOS || link->ep->state < 
BT_ASCS_ASE_STATE_QOS)
         return -EINVAL;

Also probably i should cleanup all structs (code and tests), so that cig 
and cis are initialized properly with 0xff. And then provide the fix?

On 6/10/26 00:03, Pauli Virtanen wrote:
> ti, 2026-06-09 kello 23:11 +0200, Simon Mikuda kirjoitti:
>> bap_ucast_io_link pairs streams whose CIG/CIS IDs match, but the IDs
>> are unset in Codec Configured state, so a Sink and Source bound for
>> different CISes get linked. The stray link later propagates a
>> disconnect to the wrong ASE and breaks Receiver Start Ready.
>>
>> Skip linking until QoS Configured assigns the IDs.
>>
>> Fixes PTS test BAP/USR/STR/BV-362-C
>> ---
>>   src/shared/bap.c | 6 ++++++
>>   1 file changed, 6 insertions(+)
>>
>> diff --git a/src/shared/bap.c b/src/shared/bap.c
>> index deb85b264..98537de60 100644
>> --- a/src/shared/bap.c
>> +++ b/src/shared/bap.c
>> @@ -2679,6 +2679,12 @@ static int bap_ucast_io_link(struct bt_bap_stream *stream,
>>   			stream->ep->dir == link->ep->dir)
>>   		return -EINVAL;
>>   
>> +	/* Don't link until QoS Configured assigns the CIS IDs; while unset
>> +	 * the check above would pair unrelated streams.
>> +	 */
>> +	if (!stream->qos.ucast.cis_id || !link->qos.ucast.cis_id)
>> +		return -EINVAL;
> Zero is valid CIS ID?
>
>> +
>>   	if (stream->client && !(stream->locked && link->locked))
>>   		return -EINVAL;
>>   

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH BlueZ] shared/bap: Don't link ucast streams before CIS IDs are assigned
  2026-06-10  7:46   ` Simon Mikuda
@ 2026-06-10 13:06     ` Luiz Augusto von Dentz
  2026-06-14  9:55     ` [PATCH BlueZ v2 1/2] shared/bap: Initialize ucast/bcast IDs as unset Simon Mikuda
  2026-06-14 10:50     ` [PATCH BlueZ v3 1/2] " Simon Mikuda
  2 siblings, 0 replies; 12+ messages in thread
From: Luiz Augusto von Dentz @ 2026-06-10 13:06 UTC (permalink / raw)
  To: Simon Mikuda; +Cc: Pauli Virtanen, linux-bluetooth

Hi Simon,

On Wed, Jun 10, 2026 at 3:51 AM Simon Mikuda
<simon.mikuda@streamunlimited.com> wrote:
>
> I looked into it and 0 is valid ID (probably not used, but still valid).
>
> There is a ugly part in bluez though, when stream is allocated cig and
> cis in qos struct are 0 not 0xff:
>
> stream = new0(struct bt_bap_stream, 1);   /* qos all-zero: cig/cis = 0 */
>
> and also in tests there are some struct comparisons that also use
> cig/cis == 0. Some parts check for 0xff (BT_ISO_QOS_CIG_UNSET,
> BT_ISO_QOS_CIS_UNSET)

We should probably initialize it with unset and then check if CIS/CIG
have been set upon linking.

> Maybe more clean fix would be to hook this up to state, so that when
> CIG/CIS is not at least configured it is rejected e.g.:
>
> if (stream->ep->state < BT_ASCS_ASE_STATE_QOS || link->ep->state <
> BT_ASCS_ASE_STATE_QOS)
>          return -EINVAL;
>
> Also probably i should cleanup all structs (code and tests), so that cig
> and cis are initialized properly with 0xff. And then provide the fix?
>
> On 6/10/26 00:03, Pauli Virtanen wrote:
> > ti, 2026-06-09 kello 23:11 +0200, Simon Mikuda kirjoitti:
> >> bap_ucast_io_link pairs streams whose CIG/CIS IDs match, but the IDs
> >> are unset in Codec Configured state, so a Sink and Source bound for
> >> different CISes get linked. The stray link later propagates a
> >> disconnect to the wrong ASE and breaks Receiver Start Ready.
> >>
> >> Skip linking until QoS Configured assigns the IDs.
> >>
> >> Fixes PTS test BAP/USR/STR/BV-362-C
> >> ---
> >>   src/shared/bap.c | 6 ++++++
> >>   1 file changed, 6 insertions(+)
> >>
> >> diff --git a/src/shared/bap.c b/src/shared/bap.c
> >> index deb85b264..98537de60 100644
> >> --- a/src/shared/bap.c
> >> +++ b/src/shared/bap.c
> >> @@ -2679,6 +2679,12 @@ static int bap_ucast_io_link(struct bt_bap_stream *stream,
> >>                      stream->ep->dir == link->ep->dir)
> >>              return -EINVAL;
> >>
> >> +    /* Don't link until QoS Configured assigns the CIS IDs; while unset
> >> +     * the check above would pair unrelated streams.
> >> +     */
> >> +    if (!stream->qos.ucast.cis_id || !link->qos.ucast.cis_id)
> >> +            return -EINVAL;
> > Zero is valid CIS ID?
> >
> >> +
> >>      if (stream->client && !(stream->locked && link->locked))
> >>              return -EINVAL;
> >>
>


-- 
Luiz Augusto von Dentz

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH BlueZ v2 1/2] shared/bap: Initialize ucast/bcast IDs as unset
  2026-06-10  7:46   ` Simon Mikuda
  2026-06-10 13:06     ` Luiz Augusto von Dentz
@ 2026-06-14  9:55     ` Simon Mikuda
  2026-06-14  9:55       ` [PATCH BlueZ v2 2/2] shared/bap: Don't link server ucast streams before CIS IDs are assigned Simon Mikuda
                         ` (2 more replies)
  2026-06-14 10:50     ` [PATCH BlueZ v3 1/2] " Simon Mikuda
  2 siblings, 3 replies; 12+ messages in thread
From: Simon Mikuda @ 2026-06-14  9:55 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Simon Mikuda

Also change some lines where CIS should be used instead of CIG
---
 src/shared/bap.c | 4 ++++
 unit/test-bap.c  | 4 ++--
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/shared/bap.c b/src/shared/bap.c
index deb85b264..41139181b 100644
--- a/src/shared/bap.c
+++ b/src/shared/bap.c
@@ -2901,6 +2901,10 @@ static struct bt_bap_stream *bap_stream_new(struct bt_bap *bap,
 	stream->client = client;
 	stream->ops = bap_stream_new_ops(stream);
 	stream->pending_states = queue_new();
+	stream->qos.bcast.big = BT_ISO_QOS_BIG_UNSET;
+	stream->qos.bcast.bis = BT_ISO_QOS_BIS_UNSET;
+	stream->qos.ucast.cig_id = BT_ISO_QOS_CIG_UNSET;
+	stream->qos.ucast.cis_id = BT_ISO_QOS_CIS_UNSET;
 
 	queue_push_tail(bap->streams, stream);
 
diff --git a/unit/test-bap.c b/unit/test-bap.c
index 03b19678e..4ac9a207c 100644
--- a/unit/test-bap.c
+++ b/unit/test-bap.c
@@ -9894,7 +9894,7 @@ static int streaming_ucl_create_io(struct bt_bap_stream *stream,
 
 	i = qos[0] ? qos[0]->ucast.cis_id : qos[1]->ucast.cis_id;
 
-	if (i == BT_ISO_QOS_CIG_UNSET) {
+	if (i == BT_ISO_QOS_CIS_UNSET) {
 		for (i = 0; i < ARRAY_SIZE(data->fds); ++i) {
 			if (data->fds[i][0] > 0)
 				continue;
@@ -10000,7 +10000,7 @@ static void test_select_cb(struct bt_bap_pac *pac, int err,
 
 	if (!data->cfg->streams) {
 		qos->ucast.cig_id = BT_ISO_QOS_CIG_UNSET;
-		qos->ucast.cis_id = BT_ISO_QOS_CIG_UNSET;
+		qos->ucast.cis_id = BT_ISO_QOS_CIS_UNSET;
 	} else {
 		/* All streams to separate CIS.
 		 *
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH BlueZ v2 2/2] shared/bap: Don't link server ucast streams before CIS IDs are assigned
  2026-06-14  9:55     ` [PATCH BlueZ v2 1/2] shared/bap: Initialize ucast/bcast IDs as unset Simon Mikuda
@ 2026-06-14  9:55       ` Simon Mikuda
  2026-06-14 10:24       ` [PATCH BlueZ v2 1/2] shared/bap: Initialize ucast/bcast IDs as unset Pauli Virtanen
  2026-06-14 11:05       ` [BlueZ,v2,1/2] " bluez.test.bot
  2 siblings, 0 replies; 12+ messages in thread
From: Simon Mikuda @ 2026-06-14  9:55 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Simon Mikuda

bap_ucast_io_link pairs streams whose CIG/CIS IDs match, but the IDs
are unset in Codec Configured state, so a Sink and Source bound for
different CISes get linked. The stray link later propagates a
disconnect to the wrong ASE and breaks Receiver Start Ready.

Skip linking until QoS Configured assigns the IDs.

Fixes PTS test BAP/USR/STR/BV-362-C
---
 src/shared/bap.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/src/shared/bap.c b/src/shared/bap.c
index 41139181b..935387a76 100644
--- a/src/shared/bap.c
+++ b/src/shared/bap.c
@@ -2679,6 +2679,15 @@ static int bap_ucast_io_link(struct bt_bap_stream *stream,
 			stream->ep->dir == link->ep->dir)
 		return -EINVAL;
 
+	/* The server pairs Sink and Source by matching CIG/CIS, but those are
+	 * unset until QoS Configured, so it would link unrelated ASEs (CIS 0
+	 * is otherwise a valid ID). Clients gate linking on the lock instead.
+	 */
+	if (!stream->client &&
+			(stream->qos.ucast.cis_id == BT_ISO_QOS_CIS_UNSET ||
+			link->qos.ucast.cis_id == BT_ISO_QOS_CIS_UNSET))
+		return -EINVAL;
+
 	if (stream->client && !(stream->locked && link->locked))
 		return -EINVAL;
 
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* Re: [PATCH BlueZ v2 1/2] shared/bap: Initialize ucast/bcast IDs as unset
  2026-06-14  9:55     ` [PATCH BlueZ v2 1/2] shared/bap: Initialize ucast/bcast IDs as unset Simon Mikuda
  2026-06-14  9:55       ` [PATCH BlueZ v2 2/2] shared/bap: Don't link server ucast streams before CIS IDs are assigned Simon Mikuda
@ 2026-06-14 10:24       ` Pauli Virtanen
  2026-06-14 11:05       ` [BlueZ,v2,1/2] " bluez.test.bot
  2 siblings, 0 replies; 12+ messages in thread
From: Pauli Virtanen @ 2026-06-14 10:24 UTC (permalink / raw)
  To: Simon Mikuda, linux-bluetooth

Hi,

su, 2026-06-14 kello 11:55 +0200, Simon Mikuda kirjoitti:
> Also change some lines where CIS should be used instead of CIG
> ---
>  src/shared/bap.c | 4 ++++
>  unit/test-bap.c  | 4 ++--
>  2 files changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/src/shared/bap.c b/src/shared/bap.c
> index deb85b264..41139181b 100644
> --- a/src/shared/bap.c
> +++ b/src/shared/bap.c
> @@ -2901,6 +2901,10 @@ static struct bt_bap_stream *bap_stream_new(struct bt_bap *bap,
>  	stream->client = client;
>  	stream->ops = bap_stream_new_ops(stream);
>  	stream->pending_states = queue_new();
> +	stream->qos.bcast.big = BT_ISO_QOS_BIG_UNSET;
> +	stream->qos.bcast.bis = BT_ISO_QOS_BIS_UNSET;
> +	stream->qos.ucast.cig_id = BT_ISO_QOS_CIG_UNSET;
> +	stream->qos.ucast.cis_id = BT_ISO_QOS_CIS_UNSET;

qos.bcast and qos.ucast are overlapping union members, so strictly
speaking this should check bt_bap_stream_get_type(stream) and set the
relevant union member.

>  
>  	queue_push_tail(bap->streams, stream);
>  
> diff --git a/unit/test-bap.c b/unit/test-bap.c
> index 03b19678e..4ac9a207c 100644
> --- a/unit/test-bap.c
> +++ b/unit/test-bap.c
> @@ -9894,7 +9894,7 @@ static int streaming_ucl_create_io(struct bt_bap_stream *stream,
>  
>  	i = qos[0] ? qos[0]->ucast.cis_id : qos[1]->ucast.cis_id;
>  
> -	if (i == BT_ISO_QOS_CIG_UNSET) {
> +	if (i == BT_ISO_QOS_CIS_UNSET) {
>  		for (i = 0; i < ARRAY_SIZE(data->fds); ++i) {
>  			if (data->fds[i][0] > 0)
>  				continue;
> @@ -10000,7 +10000,7 @@ static void test_select_cb(struct bt_bap_pac *pac, int err,
>  
>  	if (!data->cfg->streams) {
>  		qos->ucast.cig_id = BT_ISO_QOS_CIG_UNSET;
> -		qos->ucast.cis_id = BT_ISO_QOS_CIG_UNSET;
> +		qos->ucast.cis_id = BT_ISO_QOS_CIS_UNSET;
>  	} else {
>  		/* All streams to separate CIS.
>  		 *

-- 
Pauli Virtanen

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH BlueZ v3 1/2] shared/bap: Initialize ucast/bcast IDs as unset
  2026-06-10  7:46   ` Simon Mikuda
  2026-06-10 13:06     ` Luiz Augusto von Dentz
  2026-06-14  9:55     ` [PATCH BlueZ v2 1/2] shared/bap: Initialize ucast/bcast IDs as unset Simon Mikuda
@ 2026-06-14 10:50     ` Simon Mikuda
  2026-06-14 10:50       ` [PATCH BlueZ v3 2/2] shared/bap: Don't link server ucast streams before CIS IDs are assigned Simon Mikuda
  2026-06-14 13:03       ` [BlueZ,v3,1/2] shared/bap: Initialize ucast/bcast IDs as unset bluez.test.bot
  2 siblings, 2 replies; 12+ messages in thread
From: Simon Mikuda @ 2026-06-14 10:50 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Simon Mikuda

Also change some lines where CIS should be used instead of CIG
---
 src/shared/bap.c | 13 +++++++++++++
 unit/test-bap.c  |  4 ++--
 2 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/src/shared/bap.c b/src/shared/bap.c
index deb85b264..e8fbf0899 100644
--- a/src/shared/bap.c
+++ b/src/shared/bap.c
@@ -2902,6 +2902,19 @@ static struct bt_bap_stream *bap_stream_new(struct bt_bap *bap,
 	stream->ops = bap_stream_new_ops(stream);
 	stream->pending_states = queue_new();
 
+	switch (bt_bap_pac_get_type(lpac)) {
+	case BT_BAP_SINK:
+	case BT_BAP_SOURCE:
+		stream->qos.ucast.cig_id = BT_ISO_QOS_CIG_UNSET;
+		stream->qos.ucast.cis_id = BT_ISO_QOS_CIS_UNSET;
+		break;
+	case BT_BAP_BCAST_SOURCE:
+	case BT_BAP_BCAST_SINK:
+		stream->qos.bcast.big = BT_ISO_QOS_BIG_UNSET;
+		stream->qos.bcast.bis = BT_ISO_QOS_BIS_UNSET;
+		break;
+	}
+
 	queue_push_tail(bap->streams, stream);
 
 	return bt_bap_stream_ref(stream);
diff --git a/unit/test-bap.c b/unit/test-bap.c
index 03b19678e..4ac9a207c 100644
--- a/unit/test-bap.c
+++ b/unit/test-bap.c
@@ -9894,7 +9894,7 @@ static int streaming_ucl_create_io(struct bt_bap_stream *stream,
 
 	i = qos[0] ? qos[0]->ucast.cis_id : qos[1]->ucast.cis_id;
 
-	if (i == BT_ISO_QOS_CIG_UNSET) {
+	if (i == BT_ISO_QOS_CIS_UNSET) {
 		for (i = 0; i < ARRAY_SIZE(data->fds); ++i) {
 			if (data->fds[i][0] > 0)
 				continue;
@@ -10000,7 +10000,7 @@ static void test_select_cb(struct bt_bap_pac *pac, int err,
 
 	if (!data->cfg->streams) {
 		qos->ucast.cig_id = BT_ISO_QOS_CIG_UNSET;
-		qos->ucast.cis_id = BT_ISO_QOS_CIG_UNSET;
+		qos->ucast.cis_id = BT_ISO_QOS_CIS_UNSET;
 	} else {
 		/* All streams to separate CIS.
 		 *
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH BlueZ v3 2/2] shared/bap: Don't link server ucast streams before CIS IDs are assigned
  2026-06-14 10:50     ` [PATCH BlueZ v3 1/2] " Simon Mikuda
@ 2026-06-14 10:50       ` Simon Mikuda
  2026-06-14 13:03       ` [BlueZ,v3,1/2] shared/bap: Initialize ucast/bcast IDs as unset bluez.test.bot
  1 sibling, 0 replies; 12+ messages in thread
From: Simon Mikuda @ 2026-06-14 10:50 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Simon Mikuda

bap_ucast_io_link pairs streams whose CIG/CIS IDs match, but the IDs
are unset in Codec Configured state, so a Sink and Source bound for
different CISes get linked. The stray link later propagates a
disconnect to the wrong ASE and breaks Receiver Start Ready.

Skip linking until QoS Configured assigns the IDs.

Fixes PTS test BAP/USR/STR/BV-362-C
---
 src/shared/bap.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/src/shared/bap.c b/src/shared/bap.c
index e8fbf0899..6ba9d3e06 100644
--- a/src/shared/bap.c
+++ b/src/shared/bap.c
@@ -2679,6 +2679,15 @@ static int bap_ucast_io_link(struct bt_bap_stream *stream,
 			stream->ep->dir == link->ep->dir)
 		return -EINVAL;
 
+	/* The server pairs Sink and Source by matching CIG/CIS, but those are
+	 * unset until QoS Configured, so it would link unrelated ASEs (CIS 0
+	 * is otherwise a valid ID). Clients gate linking on the lock instead.
+	 */
+	if (!stream->client &&
+			(stream->qos.ucast.cis_id == BT_ISO_QOS_CIS_UNSET ||
+			link->qos.ucast.cis_id == BT_ISO_QOS_CIS_UNSET))
+		return -EINVAL;
+
 	if (stream->client && !(stream->locked && link->locked))
 		return -EINVAL;
 
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* RE: [BlueZ,v2,1/2] shared/bap: Initialize ucast/bcast IDs as unset
  2026-06-14  9:55     ` [PATCH BlueZ v2 1/2] shared/bap: Initialize ucast/bcast IDs as unset Simon Mikuda
  2026-06-14  9:55       ` [PATCH BlueZ v2 2/2] shared/bap: Don't link server ucast streams before CIS IDs are assigned Simon Mikuda
  2026-06-14 10:24       ` [PATCH BlueZ v2 1/2] shared/bap: Initialize ucast/bcast IDs as unset Pauli Virtanen
@ 2026-06-14 11:05       ` bluez.test.bot
  2 siblings, 0 replies; 12+ messages in thread
From: bluez.test.bot @ 2026-06-14 11:05 UTC (permalink / raw)
  To: linux-bluetooth, simon.mikuda

[-- Attachment #1: Type: text/plain, Size: 2397 bytes --]

This is automated email and please do not reply to this email!

Dear submitter,

Thank you for submitting the patches to the linux bluetooth mailing list.
This is a CI test results with your patch series:
PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=1111248

---Test result---

Test Summary:
CheckPatch                    PASS      0.92 seconds
GitLint                       FAIL      0.63 seconds
BuildEll                      PASS      20.70 seconds
BluezMake                     PASS      656.66 seconds
MakeCheck                     PASS      18.62 seconds
MakeDistcheck                 PASS      246.18 seconds
CheckValgrind                 PASS      294.94 seconds
CheckSmatch                   WARNING   355.15 seconds
bluezmakeextell               PASS      183.39 seconds
IncrementalBuild              PASS      673.90 seconds
ScanBuild                     PASS      1033.04 seconds

Details
##############################
Test: GitLint - FAIL
Desc: Run gitlint
Output:
[BlueZ,v2,2/2] shared/bap: Don't link server ucast streams before CIS IDs are assigned

1: T1 Title exceeds max length (86>80): "[BlueZ,v2,2/2] shared/bap: Don't link server ucast streams before CIS IDs are assigned"
##############################
Test: CheckSmatch - WARNING
Desc: Run smatch tool with source
Output:
src/shared/bap.c:317:25: warning: array of flexible structuressrc/shared/bap.c: note: in included file:./src/shared/ascs.h:88:25: warning: array of flexible structuressrc/shared/bap.c:317:25: warning: array of flexible structuressrc/shared/bap.c: note: in included file:./src/shared/ascs.h:88:25: warning: array of flexible structuressrc/shared/bap.c:317:25: warning: array of flexible structuressrc/shared/bap.c: note: in included file:./src/shared/ascs.h:88:25: warning: array of flexible structuressrc/shared/bap.c:317:25: warning: array of flexible structuressrc/shared/bap.c: note: in included file:./src/shared/ascs.h:88:25: warning: array of flexible structuressrc/shared/bap.c:317:25: warning: array of flexible structuressrc/shared/bap.c: note: in included file:./src/shared/ascs.h:88:25: warning: array of flexible structuressrc/shared/bap.c:317:25: warning: array of flexible structuressrc/shared/bap.c: note: in included file:./src/shared/ascs.h:88:25: warning: array of flexible structures


https://github.com/bluez/bluez/pull/2229

---
Regards,
Linux Bluetooth


^ permalink raw reply	[flat|nested] 12+ messages in thread

* RE: [BlueZ,v3,1/2] shared/bap: Initialize ucast/bcast IDs as unset
  2026-06-14 10:50     ` [PATCH BlueZ v3 1/2] " Simon Mikuda
  2026-06-14 10:50       ` [PATCH BlueZ v3 2/2] shared/bap: Don't link server ucast streams before CIS IDs are assigned Simon Mikuda
@ 2026-06-14 13:03       ` bluez.test.bot
  1 sibling, 0 replies; 12+ messages in thread
From: bluez.test.bot @ 2026-06-14 13:03 UTC (permalink / raw)
  To: linux-bluetooth, simon.mikuda

[-- Attachment #1: Type: text/plain, Size: 2396 bytes --]

This is automated email and please do not reply to this email!

Dear submitter,

Thank you for submitting the patches to the linux bluetooth mailing list.
This is a CI test results with your patch series:
PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=1111255

---Test result---

Test Summary:
CheckPatch                    PASS      0.63 seconds
GitLint                       FAIL      0.44 seconds
BuildEll                      PASS      17.83 seconds
BluezMake                     PASS      638.03 seconds
MakeCheck                     PASS      18.06 seconds
MakeDistcheck                 PASS      222.41 seconds
CheckValgrind                 PASS      278.79 seconds
CheckSmatch                   WARNING   316.71 seconds
bluezmakeextell               PASS      168.90 seconds
IncrementalBuild              PASS      639.69 seconds
ScanBuild                     PASS      926.11 seconds

Details
##############################
Test: GitLint - FAIL
Desc: Run gitlint
Output:
[BlueZ,v3,2/2] shared/bap: Don't link server ucast streams before CIS IDs are assigned

1: T1 Title exceeds max length (86>80): "[BlueZ,v3,2/2] shared/bap: Don't link server ucast streams before CIS IDs are assigned"
##############################
Test: CheckSmatch - WARNING
Desc: Run smatch tool with source
Output:
src/shared/bap.c:317:25: warning: array of flexible structuressrc/shared/bap.c: note: in included file:./src/shared/ascs.h:88:25: warning: array of flexible structuressrc/shared/bap.c:317:25: warning: array of flexible structuressrc/shared/bap.c: note: in included file:./src/shared/ascs.h:88:25: warning: array of flexible structuressrc/shared/bap.c:317:25: warning: array of flexible structuressrc/shared/bap.c: note: in included file:./src/shared/ascs.h:88:25: warning: array of flexible structuressrc/shared/bap.c:317:25: warning: array of flexible structuressrc/shared/bap.c: note: in included file:./src/shared/ascs.h:88:25: warning: array of flexible structuressrc/shared/bap.c:317:25: warning: array of flexible structuressrc/shared/bap.c: note: in included file:./src/shared/ascs.h:88:25: warning: array of flexible structuressrc/shared/bap.c:317:25: warning: array of flexible structuressrc/shared/bap.c: note: in included file:./src/shared/ascs.h:88:25: warning: array of flexible structures


https://github.com/bluez/bluez/pull/2232

---
Regards,
Linux Bluetooth


^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2026-06-14 13:03 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-09 21:11 [PATCH BlueZ] shared/bap: Don't link ucast streams before CIS IDs are assigned Simon Mikuda
2026-06-09 22:03 ` Pauli Virtanen
2026-06-10  7:46   ` Simon Mikuda
2026-06-10 13:06     ` Luiz Augusto von Dentz
2026-06-14  9:55     ` [PATCH BlueZ v2 1/2] shared/bap: Initialize ucast/bcast IDs as unset Simon Mikuda
2026-06-14  9:55       ` [PATCH BlueZ v2 2/2] shared/bap: Don't link server ucast streams before CIS IDs are assigned Simon Mikuda
2026-06-14 10:24       ` [PATCH BlueZ v2 1/2] shared/bap: Initialize ucast/bcast IDs as unset Pauli Virtanen
2026-06-14 11:05       ` [BlueZ,v2,1/2] " bluez.test.bot
2026-06-14 10:50     ` [PATCH BlueZ v3 1/2] " Simon Mikuda
2026-06-14 10:50       ` [PATCH BlueZ v3 2/2] shared/bap: Don't link server ucast streams before CIS IDs are assigned Simon Mikuda
2026-06-14 13:03       ` [BlueZ,v3,1/2] shared/bap: Initialize ucast/bcast IDs as unset bluez.test.bot
2026-06-09 23:00 ` [BlueZ] shared/bap: Don't link ucast streams before CIS IDs are assigned bluez.test.bot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox