linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH BlueZ] profiles/avdtp: Fix reply for bad media transport format
@ 2025-03-25 16:25 Frédéric Danis
  2025-03-25 17:39 ` [BlueZ] " bluez.test.bot
  2025-03-25 19:43 ` [PATCH BlueZ] " Luiz Augusto von Dentz
  0 siblings, 2 replies; 3+ messages in thread
From: Frédéric Danis @ 2025-03-25 16:25 UTC (permalink / raw)
  To: linux-bluetooth

Currently the avdtp_setconf_cmd() fails to check the capability length
of the Media Transport Service Category, which should be 0, because
caps_to_list() doesn't add it to the list of services as it should
be bigger than packet boundary.

This commit add a fake Media Transport capability with invalid length
of 1, so avdtp_setconf_cmd() can check it and send reject error
AVDTP_BAD_MEDIA_TRANSPORT_FORMAT.

This is required for passing AVDTP/SNK/ACP/TRA/BTR/BI-01-C PTS test
case:
To verify that the IUT (ACP) is able to issue a set configuration
reject response to the INT if the format of the media transport is
incorrect.
---
 profiles/audio/avdtp.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/profiles/audio/avdtp.c b/profiles/audio/avdtp.c
index 80fbe847e..67d32278f 100644
--- a/profiles/audio/avdtp.c
+++ b/profiles/audio/avdtp.c
@@ -1328,6 +1328,17 @@ static GSList *caps_to_list(uint8_t *data, size_t size,
 
 		cap = (struct avdtp_service_capability *)data;
 
+		if (cap->category == AVDTP_MEDIA_TRANSPORT &&
+					cap->length != 0) {
+			error("Invalid media transport in getcap resp");
+			cpy = util_malloc(sizeof(*cpy) + 1);
+			memcpy(cpy, cap, sizeof(*cap));
+			cpy->length = 1;
+			cpy->data[0] = 0;
+			caps = g_slist_append(caps, cpy);
+			break;
+		}
+
 		if (sizeof(*cap) + cap->length > size) {
 			error("Invalid capability data in getcap resp");
 			break;
-- 
2.43.0


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

* RE: [BlueZ] profiles/avdtp: Fix reply for bad media transport format
  2025-03-25 16:25 [PATCH BlueZ] profiles/avdtp: Fix reply for bad media transport format Frédéric Danis
@ 2025-03-25 17:39 ` bluez.test.bot
  2025-03-25 19:43 ` [PATCH BlueZ] " Luiz Augusto von Dentz
  1 sibling, 0 replies; 3+ messages in thread
From: bluez.test.bot @ 2025-03-25 17:39 UTC (permalink / raw)
  To: linux-bluetooth, frederic.danis

[-- Attachment #1: Type: text/plain, Size: 1260 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=947225

---Test result---

Test Summary:
CheckPatch                    PENDING   0.21 seconds
GitLint                       PENDING   0.20 seconds
BuildEll                      PASS      20.51 seconds
BluezMake                     PASS      1506.42 seconds
MakeCheck                     PASS      13.68 seconds
MakeDistcheck                 PASS      159.55 seconds
CheckValgrind                 PASS      216.15 seconds
CheckSmatch                   PASS      289.42 seconds
bluezmakeextell               PASS      99.94 seconds
IncrementalBuild              PENDING   0.89 seconds
ScanBuild                     PASS      866.94 seconds

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

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

##############################
Test: IncrementalBuild - PENDING
Desc: Incremental build with the patches in the series
Output:



---
Regards,
Linux Bluetooth


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

* Re: [PATCH BlueZ] profiles/avdtp: Fix reply for bad media transport format
  2025-03-25 16:25 [PATCH BlueZ] profiles/avdtp: Fix reply for bad media transport format Frédéric Danis
  2025-03-25 17:39 ` [BlueZ] " bluez.test.bot
@ 2025-03-25 19:43 ` Luiz Augusto von Dentz
  1 sibling, 0 replies; 3+ messages in thread
From: Luiz Augusto von Dentz @ 2025-03-25 19:43 UTC (permalink / raw)
  To: Frédéric Danis; +Cc: linux-bluetooth

Hi Frédéric,

On Tue, Mar 25, 2025 at 12:29 PM Frédéric Danis
<frederic.danis@collabora.com> wrote:
>
> Currently the avdtp_setconf_cmd() fails to check the capability length
> of the Media Transport Service Category, which should be 0, because
> caps_to_list() doesn't add it to the list of services as it should
> be bigger than packet boundary.
>
> This commit add a fake Media Transport capability with invalid length
> of 1, so avdtp_setconf_cmd() can check it and send reject error
> AVDTP_BAD_MEDIA_TRANSPORT_FORMAT.
>
> This is required for passing AVDTP/SNK/ACP/TRA/BTR/BI-01-C PTS test
> case:
> To verify that the IUT (ACP) is able to issue a set configuration
> reject response to the INT if the format of the media transport is
> incorrect.
> ---
>  profiles/audio/avdtp.c | 11 +++++++++++
>  1 file changed, 11 insertions(+)
>
> diff --git a/profiles/audio/avdtp.c b/profiles/audio/avdtp.c
> index 80fbe847e..67d32278f 100644
> --- a/profiles/audio/avdtp.c
> +++ b/profiles/audio/avdtp.c
> @@ -1328,6 +1328,17 @@ static GSList *caps_to_list(uint8_t *data, size_t size,
>
>                 cap = (struct avdtp_service_capability *)data;
>
> +               if (cap->category == AVDTP_MEDIA_TRANSPORT &&
> +                                       cap->length != 0) {
> +                       error("Invalid media transport in getcap resp");
> +                       cpy = util_malloc(sizeof(*cpy) + 1);
> +                       memcpy(cpy, cap, sizeof(*cap));
> +                       cpy->length = 1;
> +                       cpy->data[0] = 0;
> +                       caps = g_slist_append(caps, cpy);
> +                       break;
> +               }

Hmm, instead of fabricating the capability, how about we pass the &err
as parameter to caps_to_list so it can be set directly?

> +
>                 if (sizeof(*cap) + cap->length > size) {
>                         error("Invalid capability data in getcap resp");
>                         break;
> --
> 2.43.0
>
>


-- 
Luiz Augusto von Dentz

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

end of thread, other threads:[~2025-03-25 19:43 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-03-25 16:25 [PATCH BlueZ] profiles/avdtp: Fix reply for bad media transport format Frédéric Danis
2025-03-25 17:39 ` [BlueZ] " bluez.test.bot
2025-03-25 19:43 ` [PATCH BlueZ] " Luiz Augusto von Dentz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).