Linux bluetooth development
 help / color / mirror / Atom feed
* [BlueZ PATCH 0/4] ASCS: Add validation for PTS SPE test cases
@ 2026-07-02 13:09 raghu447
  2026-07-02 13:09 ` [BlueZ PATCH 1/4] shared/bap: Validate codec configuration parameters raghu447
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: raghu447 @ 2026-07-02 13:09 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: raghu447

This series is required to make PTS tests ASCS/SR/SPE/BI-01-C and
ASCS/SR/SPE/BI-07-C to ASCS/SR/SPE/BI-10-C pass.

raghavendra (4):
  shared/bap: Validate codec configuration parameters
  shared/bap: Validate unicast QoS configuration
  shared/bap: Handle ASCS control point protocol errors
  unit/bap: Add invalid ASCS control point tests

 src/shared/bap.c | 63 +++++++++++++++++++++++++++++++++++++++++-
 unit/test-bap.c  | 72 ++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 134 insertions(+), 1 deletion(-)


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

* [BlueZ PATCH 1/4] shared/bap: Validate codec configuration parameters
  2026-07-02 13:09 [BlueZ PATCH 0/4] ASCS: Add validation for PTS SPE test cases raghu447
@ 2026-07-02 13:09 ` raghu447
  2026-07-02 16:12   ` ASCS: Add validation for PTS SPE test cases bluez.test.bot
  2026-07-02 13:09 ` [BlueZ PATCH 2/4] shared/bap: Validate unicast QoS configuration raghu447
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 6+ messages in thread
From: raghu447 @ 2026-07-02 13:09 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: raghavendra

From: raghavendra <raghavendra.rao@collabora.com>

This is required for PTS test ASCS/SR/SPE/BI-07-C
---
 src/shared/bap.c | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/src/shared/bap.c b/src/shared/bap.c
index 1f61227f8..6bc044a63 100644
--- a/src/shared/bap.c
+++ b/src/shared/bap.c
@@ -29,6 +29,7 @@
 #include "src/shared/gatt-client.h"
 #include "src/shared/bap.h"
 #include "src/shared/ascs.h"
+#include "src/shared/lc3.h"
 #include "src/shared/bap-debug.h"
 
 /* Maximum number of ASE(s) */
@@ -3157,6 +3158,7 @@ static uint8_t ep_config(struct bt_bap_endpoint *ep, struct bt_bap *bap,
 	struct iovec cc;
 	const struct queue_entry *e;
 	struct bt_bap_codec codec;
+	uint8_t *ltv;
 
 	DBG(bap, "ep %p id 0x%02x dir 0x%02x", ep, ep->id, ep->dir);
 
@@ -3190,6 +3192,19 @@ static uint8_t ep_config(struct bt_bap_endpoint *ep, struct bt_bap *bap,
 		return 0;
 	}
 
+	ltv = cc.iov_base;
+
+	if (req->codec.id == LC3_ID && cc.iov_len == 3 &&
+			ltv[0] == 0x02 &&
+			ltv[1] == LC3_CONFIG_DURATION &&
+			ltv[2] != LC3_CONFIG_DURATION_7_5 &&
+			ltv[2] != LC3_CONFIG_DURATION_10) {
+		ascs_ase_rsp_add(rsp, req->ase,
+				BT_ASCS_RSP_CONF_INVALID,
+				BT_ASCS_REASON_CODEC_DATA);
+		return 0;
+	}
+
 	switch (ep->dir) {
 	case BT_BAP_SINK:
 		e = queue_get_entries(bap->ldb->sinks);
@@ -3207,6 +3222,13 @@ static uint8_t ep_config(struct bt_bap_endpoint *ep, struct bt_bap *bap,
 	codec.cid = le16_to_cpu(req->codec.cid);
 	codec.vid = le16_to_cpu(req->codec.vid);
 
+	if (codec.id != 0xff && (codec.cid || codec.vid)) {
+		ascs_ase_rsp_add(rsp, req->ase,
+				BT_ASCS_RSP_CONF_INVALID,
+				BT_ASCS_REASON_CODEC);
+		return 0;
+	}
+
 	for (; e; e = e->next) {
 		struct bt_bap_pac *pac = e->data;
 

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

* [BlueZ PATCH 2/4] shared/bap: Validate unicast QoS configuration
  2026-07-02 13:09 [BlueZ PATCH 0/4] ASCS: Add validation for PTS SPE test cases raghu447
  2026-07-02 13:09 ` [BlueZ PATCH 1/4] shared/bap: Validate codec configuration parameters raghu447
@ 2026-07-02 13:09 ` raghu447
  2026-07-02 13:09 ` [BlueZ PATCH 3/4] shared/bap: Handle ASCS control point protocol errors raghu447
  2026-07-02 13:09 ` [BlueZ PATCH 4/4] unit/bap: Add invalid ASCS control point tests raghu447
  3 siblings, 0 replies; 6+ messages in thread
From: raghu447 @ 2026-07-02 13:09 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: raghavendra

From: raghavendra <raghavendra.rao@collabora.com>

This is required for PTS tests ASCS/SR/SPE/BI-08-C and ASCS/SR/SPE/BI-10-C.
---
 src/shared/bap.c | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)

diff --git a/src/shared/bap.c b/src/shared/bap.c
index 6bc044a63..f2be7c07b 100644
--- a/src/shared/bap.c
+++ b/src/shared/bap.c
@@ -3316,6 +3316,32 @@ static uint8_t ep_qos(struct bt_bap_endpoint *ep, struct bt_bap *bap,
 		return 0;
 	}
 
+	if (ep->stream->lpac->codec.id == LC3_ID &&
+			qos->ucast.io_qos.interval < 0x0000ff) {
+		ascs_ase_rsp_add(rsp, ep->id,
+				BT_ASCS_RSP_CONF_INVALID,
+				BT_ASCS_REASON_INTERVAL);
+		return 0;
+	}
+
+	if (qos->ucast.framing != BT_ASCS_QOS_FRAMING_UNFRAMED &&
+			qos->ucast.framing != BT_ASCS_QOS_FRAMING_FRAMED) {
+		ascs_ase_rsp_add(rsp, ep->id,
+				BT_ASCS_RSP_CONF_INVALID,
+				BT_ASCS_REASON_FRAMING);
+		return 0;
+	}
+
+	if (!qos->ucast.io_qos.phys ||
+			(qos->ucast.io_qos.phys & ~(BT_BAP_CONFIG_PHY_1M |
+					BT_BAP_CONFIG_PHY_2M |
+					BT_BAP_CONFIG_PHY_CODEC))) {
+		ascs_ase_rsp_add(rsp, ep->id,
+				BT_ASCS_RSP_CONF_INVALID,
+				BT_ASCS_REASON_PHY);
+		return 0;
+	}
+
 	return stream_qos(ep->stream, qos, rsp);
 }
 

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

* [BlueZ PATCH 3/4] shared/bap: Handle ASCS control point protocol errors
  2026-07-02 13:09 [BlueZ PATCH 0/4] ASCS: Add validation for PTS SPE test cases raghu447
  2026-07-02 13:09 ` [BlueZ PATCH 1/4] shared/bap: Validate codec configuration parameters raghu447
  2026-07-02 13:09 ` [BlueZ PATCH 2/4] shared/bap: Validate unicast QoS configuration raghu447
@ 2026-07-02 13:09 ` raghu447
  2026-07-02 13:09 ` [BlueZ PATCH 4/4] unit/bap: Add invalid ASCS control point tests raghu447
  3 siblings, 0 replies; 6+ messages in thread
From: raghu447 @ 2026-07-02 13:09 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: raghavendra

From: raghavendra <raghavendra.rao@collabora.com>

This is required for PTS tests ASCS/SR/SPE/BI-01-C and ASCS/SR/SPE/BI-09-C.
---
 src/shared/bap.c | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/src/shared/bap.c b/src/shared/bap.c
index f2be7c07b..32bb3a894 100644
--- a/src/shared/bap.c
+++ b/src/shared/bap.c
@@ -3407,7 +3407,7 @@ static uint8_t stream_enable(struct bt_bap_stream *stream, struct iovec *meta,
 static bool ascs_metadata_rsp(struct bt_bap_endpoint *ep, struct iovec *meta,
 							struct iovec *rsp)
 {
-	struct bt_ltv *ltv;
+	struct bt_ltv *ltv, *next;
 	uint16_t supported_context = 0;
 	uint16_t context;
 
@@ -3423,6 +3423,18 @@ static bool ascs_metadata_rsp(struct bt_bap_endpoint *ep, struct iovec *meta,
 		return true;
 	}
 
+	if (meta->iov_len >= sizeof(*ltv) &&
+			meta->iov_len >= (size_t) ltv->len + 1 + sizeof(*next)) {
+		next = (void *)((uint8_t *)meta->iov_base + ltv->len + 1);
+		if (next->type < BAP_METADATA_PREF_CONTEXT_LTV_TYPE ||
+				next->type > BAP_METADATA_LANGUAGE_LTV_TYPE) {
+			ascs_ase_rsp_add(rsp, ep->id,
+					BT_ASCS_RSP_METADATA_UNSUPPORTED,
+					next->type);
+			return true;
+		}
+	}
+
 	if (meta->iov_len >= sizeof(*ltv) + sizeof(context) &&
 			ltv->type == BAP_METADATA_CONTEXT_LTV_TYPE &&
 			ltv->len == sizeof(context) + 1) {
@@ -3921,6 +3933,7 @@ static void ascs_ase_cp_write(struct gatt_db_attribute *attrib,
 	} else {
 		DBG(bap, "Unknown opcode 0x%02x", hdr->op);
 		ascs_ase_rsp_add_errno(rsp, 0x00, -ENOTSUP);
+		ret = 0;
 	}
 
 respond:

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

* [BlueZ PATCH 4/4] unit/bap: Add invalid ASCS control point tests
  2026-07-02 13:09 [BlueZ PATCH 0/4] ASCS: Add validation for PTS SPE test cases raghu447
                   ` (2 preceding siblings ...)
  2026-07-02 13:09 ` [BlueZ PATCH 3/4] shared/bap: Handle ASCS control point protocol errors raghu447
@ 2026-07-02 13:09 ` raghu447
  3 siblings, 0 replies; 6+ messages in thread
From: raghu447 @ 2026-07-02 13:09 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: raghavendra

From: raghavendra <raghavendra.rao@collabora.com>

Adds coverage for PTS tests ASCS/SR/SPE/BI-01-C and BI-07-C to BI-10-C.
---
 unit/test-bap.c | 72 +++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 72 insertions(+)

diff --git a/unit/test-bap.c b/unit/test-bap.c
index 4e89ba6af..60190ef69 100644
--- a/unit/test-bap.c
+++ b/unit/test-bap.c
@@ -4446,11 +4446,82 @@ static void test_usr_spe(void)
 			SPE_METADATA_INVALID_CONTEXT(SRC_ID(0)));
 }
 
+/* Audio Stream Control Service Procedure Errors */
+
+#define ASCS_CONFIG_CODEC_INVALID(_ase) \
+	DISC_SRC_ASE_LC3, \
+	IOV_DATA(SCC_PDU(1), SCC_PDU_ASE(_ase, \
+			0x06, 0x01, 0x00, 0x01, 0x00, \
+			0x0a, 0x02, 0x01, 0x03, 0x02, 0x02, 0x01, \
+			0x03, 0x04, 0x28, 0x00)), \
+	ASE_CP_RSP(0x01, _ase, 0x09, 0x01), \
+	IOV_DATA(SCC_PDU(1), SCC_PDU_ASE(_ase, \
+			LC3_CODEC_ID_DATA, 0x03, 0x02, 0x02, 0x0a)), \
+	ASE_CP_RSP(0x01, _ase, 0x09, 0x02)
+
+#define ASCS_QOS_REQ(_ase, _i0, _i1, _i2, _framing, _phy) \
+	IOV_DATA(QOS_PDU(1), QOS_PDU_ASE(_ase, 0, _i0, _i1, _i2, \
+			_framing, _phy, \
+			0x28, 0x00, 0x02, 0x0a, 0x00, 0x40, 0x9c, 0x00))
+
+#define ASCS_QOS_INVALID(_ase) \
+	DISC_SRC_ASE_LC3, \
+	SCC_SRC(LC3_CODEC_ID_DATA, \
+			0x0a, 0x02, 0x01, 0x03, 0x02, 0x02, 0x01, \
+			0x03, 0x04, 0x28, 0x00), \
+	ASCS_QOS_REQ(_ase, 0xfe, 0x00, 0x00, 0x00, 0x02), \
+	ASE_CP_RSP(0x02, _ase, 0x09, 0x03), \
+	ASCS_QOS_REQ(_ase, 0x10, 0x27, 0x00, 0x02, 0x02), \
+	ASE_CP_RSP(0x02, _ase, 0x09, 0x04), \
+	ASCS_QOS_REQ(_ase, 0x10, 0x27, 0x00, 0x00, 0x80), \
+	ASE_CP_RSP(0x02, _ase, 0x09, 0x05)
+
+#define ASCS_QOS_INVALID_STATE(_ase) \
+	DISC_SRC_ASE_LC3, \
+	ASCS_QOS_REQ(_ase, 0x10, 0x27, 0x00, 0x00, 0x80), \
+	ASE_CP_RSP(0x02, _ase, 0x04, 0x00)
+
+#define ASCS_CP_UNSUPPORTED(_op) \
+	DISC_SRC_ASE_LC3, \
+	IOV_DATA(0x12, CP_HND, _op, 0x01), \
+	IOV_DATA(0x13), \
+	IOV_DATA(0x1b, CP_HND, _op, 0xff, 0x00, 0x01, 0x00)
+
+#define ASCS_METADATA_FOLLOWING_UNSUPPORTED(_ase) \
+	SCC_SRC_ENABLE, \
+	IOV_DATA(0x52, CP_HND, 0x07, 0x01, _ase, 0x06, \
+			0x03, 0x02, 0x01, 0x00, 0x01, 0xf0), \
+	ASE_CP_RSP(0x07, _ase, 0x0a, 0xf0)
+
+static void test_ascs_sr_spe(void)
+{
+	define_test("ASCS/SR/SPE/BI-01-C",
+			test_setup_server, test_server, NULL,
+			ASCS_CP_UNSUPPORTED(0xff));
+	define_test("ASCS/SR/SPE/BI-07-C",
+			test_setup_server, test_server, NULL,
+			ASCS_CONFIG_CODEC_INVALID(SRC_ID(0)));
+	define_test("ASCS/SR/SPE/BI-08-C",
+			test_setup_server, test_server, NULL,
+			ASCS_QOS_INVALID(SRC_ID(0)));
+	define_test("ASCS/SR/SPE/BI-09-C",
+			test_setup_server, test_server, &cfg_src_enable,
+			ASCS_METADATA_FOLLOWING_UNSUPPORTED(SRC_ID(0)));
+	define_test("ASCS/SR/SPE/BI-10-C",
+			test_setup_server, test_server, NULL,
+			ASCS_QOS_INVALID_STATE(SRC_ID(0)));
+}
+
 static void test_spe(void)
 {
 	test_usr_spe();
 }
 
+static void test_ascs(void)
+{
+	test_ascs_sr_spe();
+}
+
 #define SNK_ENABLE \
 	IOV_DATA(0x52, 0x22, 0x00, 0x03, 0x01, 0x01, 0x04, 0x03, 0x02, 0x01, \
 			00), \
@@ -10405,6 +10476,7 @@ int main(int argc, char *argv[])
 
 	test_disc();
 	test_spe();
+	test_ascs();
 	test_scc();
 	test_bsrc_scc();
 	test_bsnk_scc();

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

* RE: ASCS: Add validation for PTS SPE test cases
  2026-07-02 13:09 ` [BlueZ PATCH 1/4] shared/bap: Validate codec configuration parameters raghu447
@ 2026-07-02 16:12   ` bluez.test.bot
  0 siblings, 0 replies; 6+ messages in thread
From: bluez.test.bot @ 2026-07-02 16:12 UTC (permalink / raw)
  To: linux-bluetooth, raghavendra.rao

[-- Attachment #1: Type: text/plain, Size: 3521 bytes --]

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

---Test result---

Test Summary:
CheckPatch                    FAIL      1.72 seconds
GitLint                       PASS      1.37 seconds
BuildEll                      PASS      19.94 seconds
BluezMake                     PASS      502.85 seconds
MakeCheck                     PASS      19.31 seconds
MakeDistcheck                 PASS      150.76 seconds
CheckValgrind                 PASS      217.00 seconds
CheckSmatch                   WARNING   289.02 seconds
bluezmakeextell               PASS      94.04 seconds
IncrementalBuild              PASS      661.80 seconds
ScanBuild                     PASS      884.71 seconds

Details
##############################
Test: CheckPatch - FAIL
Desc: Run checkpatch.pl script
Output:
[BlueZ,3/4] shared/bap: Handle ASCS control point protocol errors
WARNING:LONG_LINE: line length of 81 exceeds 80 columns
#96: FILE: src/shared/bap.c:3427:
+			meta->iov_len >= (size_t) ltv->len + 1 + sizeof(*next)) {

/github/workspace/src/patch/14659293.patch total: 0 errors, 1 warnings, 33 lines checked

NOTE: For some of the reported defects, checkpatch may be able to
      mechanically convert to the typical style using --fix or --fix-inplace.

/github/workspace/src/patch/14659293.patch has style problems, please review.

NOTE: Ignored message types: COMMIT_MESSAGE COMPLEX_MACRO CONST_STRUCT FILE_PATH_CHANGES MISSING_SIGN_OFF PREFER_PACKED SPDX_LICENSE_TAG SPLIT_STRING SSCANF_TO_KSTRTO

NOTE: If any of the errors are false positives, please report
      them to the maintainer, see CHECKPATCH in MAINTAINERS.


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


https://github.com/bluez/bluez/pull/2263

---
Regards,
Linux Bluetooth


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

end of thread, other threads:[~2026-07-02 16:12 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-02 13:09 [BlueZ PATCH 0/4] ASCS: Add validation for PTS SPE test cases raghu447
2026-07-02 13:09 ` [BlueZ PATCH 1/4] shared/bap: Validate codec configuration parameters raghu447
2026-07-02 16:12   ` ASCS: Add validation for PTS SPE test cases bluez.test.bot
2026-07-02 13:09 ` [BlueZ PATCH 2/4] shared/bap: Validate unicast QoS configuration raghu447
2026-07-02 13:09 ` [BlueZ PATCH 3/4] shared/bap: Handle ASCS control point protocol errors raghu447
2026-07-02 13:09 ` [BlueZ PATCH 4/4] unit/bap: Add invalid ASCS control point tests raghu447

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