Skip to contentSkip to conversation

bass: Fix attaching to unicast session

PATCH Applied Luiz Augusto von Dentz 3 participants 4 messages Dec 4, 2025 – Dec 5, 2025 Bluetooth drivers

lore
Share & tools
lore

Luiz Augusto von Dentz

author maintainer
#0 lore raw

PATCH 1/2 bass: Fix attaching to unicast session

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

This attempst to check if bt_bap session is attached to an ATT channel then it shall be considered an unicast session not a broadcast session.

---
 profiles/audio/bass.c | 4 ++++
 1 file changed, 4 insertions(+)
profiles/audio/bass.c +4 -0
index 8886a27d99b6..20c37323bb0e 100644
@@ -1298,6 +1298,10 @@ static void bap_bc_attached(struct bt_bap *bap, void *user_data)
 	struct btd_adapter *adapter;
 	struct bass_data *data;
 
+	/* Only handle broadcast session */
+	if (bt_bap_get_att(bap))
+		return;
+
 	DBG("%p", bap);
 
 	db = btd_gatt_database_get(bt_bap_get_db(bap, false));
Signature · 1 line
2.52.0
author maintainer
#1 lore raw

PATCH 2/2 shared/bap: Fix parsing of BT_ASCS_METADATA for multiple ASE IDs

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

bt_ascs_metadata is variable length so when there are multiple ASE IDs each item needs to be parsed according to its length otherwise it would cause issues such as bellow where the ASE IDs is incorrectly parse:

Quoted 1 line

ACL Data RX: Handle 2048 flags 0x02 dlen 25

      ATT: Write Command (0x52) len 20
        Handle: 0x009b Type: ASE Control Point (0x2bc6)
          Data[18]: 070201060302040001050206030204000105
            Opcode: Update Metadata (0x07)
            Number of ASE(s): 2
            ASE: #0
            ASE ID: 0x01
            Metadata: #0: len 0x03 type 0x02
              Context: 0x0004
                Media (0x0004)
            Metadata: #1: len 0x01 type 0x05
            ASE: #1
            ASE ID: 0x02
            Metadata: #0: len 0x03 type 0x02
              Context: 0x0004
                Media (0x0004)
            Metadata: #1: len 0x01 type 0x05

= first LTV in the metadata is incorrectly used as ASE ID (0x03) src/shared/bap.c:ep_metadata() ep 0x55b1f428d490 id 0x03 dir 0x02 src/shared/bap.c:ep_metadata() Invalid state config

< ACL Data TX: Handle 2048 [1/6] flags 0x00 dlen 15

      ATT: Handle Value Notification (0x1b) len 10
        Handle: 0x009b Type: ASE Control Point (0x2bc6)
          Data[8]: 0702010000030400
            Opcode: Update Metadata (0x07)
            Number of ASE(s): 2
            ASE: #0
            ASE ID: 0x01
            ASE Response Code: Success (0x00)
            ASE Response Reason: None (0x00)
            ASE: #1
            ASE ID: 0x03
            ASE Response Code: Invalid ASE State (0x04)
            ASE Response Reason: None (0x00)
---
 src/shared/bap.c | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)
src/shared/bap.c +12 -4
index 27321a3d1e3d..b5840d18a820 100644
@@ -3508,10 +3508,12 @@ static uint8_t ascs_stop(struct bt_ascs *ascs, struct bt_bap *bap,
 	return ep_stop(ep, rsp);
 }
 
-static uint8_t ep_metadata(struct bt_bap_endpoint *ep, struct iovec *meta,
-						struct iovec *rsp)
+static uint8_t ep_metadata(struct bt_bap_endpoint *ep,
+				struct bt_ascs_metadata *req,
+				struct iovec *iov, struct iovec *rsp)
 {
 	struct bt_bap_stream *stream = ep->stream;
+	struct iovec meta;
 
 	DBG(stream->bap, "ep %p id 0x%02x dir 0x%02x", ep, ep->id, ep->dir);
 
@@ -3530,7 +3532,13 @@ static uint8_t ep_metadata(struct bt_bap_endpoint *ep, struct iovec *meta,
 		return 0;
 	}
 
-	return stream_metadata(ep->stream, meta, rsp);
+	if (iov->iov_len < req->len)
+		return BT_ATT_ERROR_INVALID_ATTRIBUTE_VALUE_LEN;
+
+	meta.iov_base = util_iov_pull_mem(iov, req->len);
+	meta.iov_len = req->len;
+
+	return stream_metadata(ep->stream, &meta, rsp);
 }
 
 static uint8_t ascs_metadata(struct bt_ascs *ascs, struct bt_bap *bap,
@@ -3557,7 +3565,7 @@ static uint8_t ascs_metadata(struct bt_ascs *ascs, struct bt_bap *bap,
 		return 0;
 	}
 
-	return ep_metadata(ep, iov, rsp);
+	return ep_metadata(ep, req, iov, rsp);
 }
 
 static uint8_t ascs_release(struct bt_ascs *ascs, struct bt_bap *bap,
Signature · 1 line
2.52.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=1030563

---Test result---

Test Summary:

CheckPatch                    PENDING   0.30 seconds
GitLint                       PENDING   0.30 seconds
BuildEll                      PASS      20.11 seconds
BluezMake                     PASS      644.50 seconds
MakeCheck                     PASS      22.28 seconds
MakeDistcheck                 PASS      243.38 seconds
CheckValgrind                 PASS      303.36 seconds
CheckSmatch                   WARNING   352.64 seconds
bluezmakeextell               PASS      184.62 seconds
IncrementalBuild              PENDING   0.39 seconds
ScanBuild                     PASS      1028.84 seconds

Details
##############################
Test: CheckPatch - PENDING
Desc: Run checkpatch.pl script Output:

##############################
Test: GitLint - PENDING
Desc: Run gitlint
Output:

##############################
Test: CheckSmatch - WARNING
Desc: Run smatch tool with source
Output:
src/shared/bap.c:312: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:312: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:312:25: warning: array of flexible structuressrc/shared/bap.c: note: in included file:./src/shared/ascs.h:88:25: warning: array of flexible structures
##############################
Test: IncrementalBuild - PENDING
Desc: Incremental build with the patches in the series
Output:

---
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 Thu, 4 Dec 2025 13:31:14 -0500 you wrote:

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

This attempst to check if bt_bap session is attached to an ATT channel then it shall be considered an unicast session not a broadcast session.

---
 profiles/audio/bass.c | 4 ++++
 1 file changed, 4 insertions(+)

Here is the summary with links:
- [BlueZ,v1,1/2] bass: Fix attaching to unicast session

    https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=90a2447a39fc
  - [BlueZ,v1,2/2] shared/bap: Fix parsing of BT_ASCS_METADATA for multiple ASE IDs
    https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=753262031701

You are awesome, thank you!

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