Linux bluetooth development
 help / color / mirror / Atom feed
* [PATCH BlueZ v3 1/5] bass: Fix possible crash on bass_update_bis_sync
@ 2026-06-29 14:26 Luiz Augusto von Dentz
  2026-06-29 14:26 ` [PATCH BlueZ v3 2/5] shared/bap: Check if stream is valid before attempting to release Luiz Augusto von Dentz
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Luiz Augusto von Dentz @ 2026-06-29 14:26 UTC (permalink / raw)
  To: linux-bluetooth

From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>

bass_update_bis_sync does use bass_remove_bis which may end up
removing the current entry causing a crash on entry->next, to avoid
that prefetch the next entry.
---
 profiles/audio/bass.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/profiles/audio/bass.c b/profiles/audio/bass.c
index a5ef80fbc835..533d45babfeb 100644
--- a/profiles/audio/bass.c
+++ b/profiles/audio/bass.c
@@ -2014,11 +2014,15 @@ static void bass_update_bis_sync(struct bass_delegator *dg,
 	const struct queue_entry *entry;
 
 	/* Check if existing setups if BIS needs to be added/removed */
-	for (entry = queue_get_entries(dg->setups); entry;
-				entry = entry->next) {
+	for (entry = queue_get_entries(dg->setups); entry;) {
 		struct bass_setup *setup = entry->data;
 		uint8_t state;
 
+		/* Prefetch next entry since the likes of bass_remove_bis can
+		 * end up removing the next entry.
+		 */
+		entry = entry->next;
+
 		state = bt_bap_stream_get_state(setup->stream);
 
 		DBG("stream %p: BIS %d state %s(%u)", setup->stream, setup->bis,
-- 
2.54.0


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

end of thread, other threads:[~2026-06-30 20:33 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-29 14:26 [PATCH BlueZ v3 1/5] bass: Fix possible crash on bass_update_bis_sync Luiz Augusto von Dentz
2026-06-29 14:26 ` [PATCH BlueZ v3 2/5] shared/bap: Check if stream is valid before attempting to release Luiz Augusto von Dentz
2026-06-29 14:26 ` [PATCH BlueZ v3 3/5] shared/bap: Don't transition to IDLE inside bap_bcast_set_state Luiz Augusto von Dentz
2026-06-29 14:26 ` [PATCH BlueZ v3 4/5] shared/bap: Use queue_foreach to notify state changes Luiz Augusto von Dentz
2026-06-29 17:37 ` [BlueZ,v3,1/5] bass: Fix possible crash on bass_update_bis_sync bluez.test.bot
2026-06-30 20:32 ` [PATCH BlueZ v3 1/5] " 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