public inbox for linux-bluetooth@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH BlueZ] shared/bap: check lpac type in bap_bcast_stream_new()
@ 2025-06-08 20:31 Pauli Virtanen
  2025-06-08 21:56 ` [BlueZ] " bluez.test.bot
  2025-06-09 15:40 ` [PATCH BlueZ] " patchwork-bot+bluetooth
  0 siblings, 2 replies; 3+ messages in thread
From: Pauli Virtanen @ 2025-06-08 20:31 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Pauli Virtanen

bap_bcast_stream_new() shall refuse to create streams if lpac is not of
broadcast type.
---

Notes:
    I ran across an unreproducible crash, where during connection dropping a
    crash occurred IIRC due to stream->rpac == NULL, as if bt_bap_stream_new()
    had produced a bcast stream for unicast lpac.
    
    Not sure if it is actually possible that bt_bap_stream_new() is called
    from unicast setup when bt_bap_get_att(bap) == false (via
    gatt_client_ready callback?), but it's probably better to check the lpac
    type here regardless.

 src/shared/bap.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/shared/bap.c b/src/shared/bap.c
index f0c6f6485..854855f6b 100644
--- a/src/shared/bap.c
+++ b/src/shared/bap.c
@@ -6155,6 +6155,8 @@ static struct bt_bap_stream *bap_bcast_stream_new(struct bt_bap *bap,
 		ep = queue_find(bap->remote_eps, find_ep_source, NULL);
 		if (!ep)
 			return NULL;
+	} else if (lpac->type != BT_BAP_BCAST_SINK) {
+		return NULL;
 	}
 
 	if (!stream)
-- 
2.49.0


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

end of thread, other threads:[~2025-06-09 15:39 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-08 20:31 [PATCH BlueZ] shared/bap: check lpac type in bap_bcast_stream_new() Pauli Virtanen
2025-06-08 21:56 ` [BlueZ] " bluez.test.bot
2025-06-09 15:40 ` [PATCH BlueZ] " patchwork-bot+bluetooth

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