All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH BlueZ v2 0/2] bap: Allocate memory for broadcast code
@ 2024-06-19  9:51 Vlad Pruteanu
  2024-06-19  9:51 ` [PATCH BlueZ v2 1/2] shared/util: Add util_iov_new function Vlad Pruteanu
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Vlad Pruteanu @ 2024-06-19  9:51 UTC (permalink / raw)
  To: linux-bluetooth
  Cc: mihai-octavian.urzica, iulia.tanasescu, andrei.istodorescu,
	luiz.dentz, Vlad Pruteanu

Currently the broadcast code is set without memory being allocated
for it resulting in segmentation fault. This implements an util_iov_new
function that allocates the memory before setting the user_data. The issue is
fixed by using this function instead of util_iov_append.

Vlad Pruteanu (2):
  shared/util: Add util_iov_new function
  bap: Use util_iov_new when setting bcode

 profiles/audio/bap.c |  5 ++---
 src/shared/util.c    | 10 ++++++++++
 src/shared/util.h    |  1 +
 3 files changed, 13 insertions(+), 3 deletions(-)

-- 
2.40.1


^ permalink raw reply	[flat|nested] 6+ messages in thread
* [PATCH BlueZ 1/1] bap: Allocate memory for broadcast code
@ 2024-06-18  8:58 Vlad Pruteanu
  2024-06-18 10:44 ` bluez.test.bot
  0 siblings, 1 reply; 6+ messages in thread
From: Vlad Pruteanu @ 2024-06-18  8:58 UTC (permalink / raw)
  To: linux-bluetooth
  Cc: mihai-octavian.urzica, silviu.barbulescu, iulia.tanasescu,
	andrei.istodorescu, luiz.dentz, Vlad Pruteanu

This fixes segmentation fault caused by trying to write to
unallocated memory.
---
 profiles/audio/bap.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/profiles/audio/bap.c b/profiles/audio/bap.c
index 53e7b3e34..3d249a4e4 100644
--- a/profiles/audio/bap.c
+++ b/profiles/audio/bap.c
@@ -1041,10 +1041,12 @@ static void create_stream_for_bis(struct bap_data *bap_data,
 	setup->qos.bcast.packing = qos->bcast.packing;
 	setup->qos.bcast.framing = qos->bcast.framing;
 	setup->qos.bcast.encryption = qos->bcast.encryption;
-	if (setup->qos.bcast.encryption)
+	if (setup->qos.bcast.encryption) {
+		setup->qos.bcast.bcode = new0(struct iovec, 1);
 		util_iov_append(setup->qos.bcast.bcode,
 				qos->bcast.bcode,
 				sizeof(qos->bcast.bcode));
+	}
 	setup->qos.bcast.options = qos->bcast.options;
 	setup->qos.bcast.skip = qos->bcast.skip;
 	setup->qos.bcast.sync_timeout = qos->bcast.sync_timeout;
-- 
2.40.1


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

end of thread, other threads:[~2024-06-19 14:10 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-06-19  9:51 [PATCH BlueZ v2 0/2] bap: Allocate memory for broadcast code Vlad Pruteanu
2024-06-19  9:51 ` [PATCH BlueZ v2 1/2] shared/util: Add util_iov_new function Vlad Pruteanu
2024-06-19 12:07   ` bap: Allocate memory for broadcast code bluez.test.bot
2024-06-19  9:51 ` [PATCH BlueZ v2 2/2] bap: Use util_iov_new when setting bcode Vlad Pruteanu
2024-06-19 14:10 ` [PATCH BlueZ v2 0/2] bap: Allocate memory for broadcast code patchwork-bot+bluetooth
  -- strict thread matches above, loose matches on Subject: below --
2024-06-18  8:58 [PATCH BlueZ 1/1] " Vlad Pruteanu
2024-06-18 10:44 ` bluez.test.bot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.