Skip to contentSkip to conversation

client/player: Fix crashes accessing metadata

PATCH Applied Luiz Augusto von Dentz 3 participants 4 messages May 11, 2023 – May 12, 2023 Bluetooth drivers

lore
Share & tools
lore

Luiz Augusto von Dentz

author maintainer
#0 lore raw

PATCH 1/2 client/player: Fix crashes accessing metadata

From: Luiz Augusto von Dentz <[email protected]>

If metadata is not set the respective iovec is left NULL so it needs to be checked before accessing its fields.

---
 client/player.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
client/player.c +3 -2
index f055ff941569..091d7005f42a 100644
@@ -1743,7 +1743,7 @@ static void append_properties(DBusMessageIter *iter,
 					DBUS_TYPE_BYTE, &cfg->caps->iov_base,
 					cfg->caps->iov_len);
 
-	if (cfg->meta->iov_len) {
+	if (cfg->meta && cfg->meta->iov_len) {
 		g_dbus_dict_append_basic_array(&dict, DBUS_TYPE_STRING, &meta,
 				DBUS_TYPE_BYTE, &cfg->meta->iov_base,
 				cfg->meta->iov_len);
@@ -1850,7 +1850,8 @@ static DBusMessage *endpoint_select_properties_reply(struct endpoint *ep,
 	cfg->target_latency = preset->target_latency;
 
 	/* Copy metadata */
-	iov_append(&cfg->meta, cfg->ep->meta->iov_base, cfg->ep->meta->iov_len);
+	if (ep->meta)
+		iov_append(&cfg->meta, ep->meta->iov_base, ep->meta->iov_len);
 
 	if (preset->qos.phy)
 		/* Set QoS parameters */
Signature · 1 line
2.40.0
author maintainer
#1 lore raw

PATCH 2/2 shared/bap: Fix not sending ASE Receiver Stop Ready

From: Luiz Augusto von Dentz <[email protected]>

This fixes not sending ASE Receiver Stop Ready if stream is on disabling state when CIS is disconnected.

---
 src/shared/bap.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)
src/shared/bap.c +15 -0
index 6131c312865a..f194f466fde1 100644
@@ -1115,6 +1115,18 @@ static bool match_stream_io(const void *data, const void *user_data)
 	return stream->io == io;
 }
 
+static void stream_stop_disabling(void *data, void *user_data)
+{
+	struct bt_bap_stream *stream = data;
+
+	if (stream->io || stream->ep->state != BT_ASCS_ASE_STATE_DISABLING)
+		return;
+
+	DBG(stream->bap, "stream %p", stream);
+
+	bt_bap_stream_stop(stream, NULL, NULL);
+}
+
 static bool bap_stream_io_detach(struct bt_bap_stream *stream)
 {
 	struct bt_bap_stream *link;
@@ -1133,6 +1145,9 @@ static bool bap_stream_io_detach(struct bt_bap_stream *stream)
 		/* Detach link if in QoS state */
 		if (link->ep->state == BT_ASCS_ASE_STATE_QOS)
 			bap_stream_io_detach(link);
+	} else {
+		/* Links without IO on disabling state shall be stopped. */
+		queue_foreach(stream->links, stream_stop_disabling, NULL);
 	}
 
 	stream_io_unref(io);
Signature · 1 line
2.40.0
#2 lore raw
In reply to Luiz Augusto von Dentz

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=746595

---Test result---

Test Summary:

CheckPatch                    PASS      1.05 seconds
GitLint                       PASS      0.71 seconds
BuildEll                      PASS      26.91 seconds
BluezMake                     PASS      1003.92 seconds
MakeCheck                     PASS      12.50 seconds
MakeDistcheck                 PASS      155.98 seconds
CheckValgrind                 PASS      252.51 seconds
CheckSmatch                   PASS      338.80 seconds
bluezmakeextell               PASS      102.02 seconds
IncrementalBuild              PASS      1716.07 seconds
ScanBuild                     PASS      1049.43 seconds

---
Regards,
Linux Bluetooth

#3 lore raw
In reply to Luiz Augusto von Dentz
This series was applied to bluetooth/bluez.git (master) by Luiz Augusto von Dentz <[email protected]>:

Hello:

This series was applied to bluetooth/bluez.git (master) by Luiz Augusto von Dentz <[email protected]>:

Quoted 7 lines · On Wed, 10 May 2023 17:01:54 -0700 you wrote:

From: Luiz Augusto von Dentz <[email protected]>

If metadata is not set the respective iovec is left NULL so it needs to be checked before accessing its fields.

---
 client/player.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

Here is the summary with links:
- [BlueZ,1/2] client/player: Fix crashes accessing metadata

    https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=67fd8479f11c
  - [BlueZ,2/2] shared/bap: Fix not sending ASE Receiver Stop Ready
    https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=24b4ba1a3936

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html