public inbox for linux-bluetooth@vger.kernel.org
 help / color / mirror / Atom feed
* Re: [PATCH] AVDTP Qualification: Fix error handling for AVDTP set configuration command
  2009-03-26 23:51 [PATCH] AVDTP Qualification: Fix error handling for AVDTP set configuration command Nick Pelly
@ 2009-03-25 23:01 ` Marcel Holtmann
  2009-03-27  0:43   ` Nick Pelly
  0 siblings, 1 reply; 3+ messages in thread
From: Marcel Holtmann @ 2009-03-25 23:01 UTC (permalink / raw)
  To: Nick Pelly; +Cc: linux-bluetooth

Hi Nick,

> +
> +               if ((cap->category == AVDTP_MEDIA_TRANSPORT) &&
> (cap->length != 0)) {
> +                       err = AVDTP_BAD_MEDIA_TRANSPORT_FORMAT;
> +                       goto failed;

no need to put brackets around cap->cat == ... check etc. The comparison
takes precedence over &&. Please fix and re-send the patch.

Regards

Marcel



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

* [PATCH] AVDTP Qualification: Fix error handling for AVDTP set configuration command
@ 2009-03-26 23:51 Nick Pelly
  2009-03-25 23:01 ` Marcel Holtmann
  0 siblings, 1 reply; 3+ messages in thread
From: Nick Pelly @ 2009-03-26 23:51 UTC (permalink / raw)
  To: linux-bluetooth

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



[-- Attachment #2: 0005-AVDTP-Qualification-Fix-error-handling-for-AVDTP-se.patch --]
[-- Type: text/x-patch, Size: 1373 bytes --]

From 2caee7eb2f475a932fc7594f4c0beaf26a67d4f7 Mon Sep 17 00:00:00 2001
From: Nick Pelly <npelly@google.com>
Date: Thu, 26 Mar 2009 16:23:25 -0700
Subject: [PATCH] AVDTP Qualification: Fix error handling for AVDTP set configuration command.

---
 audio/avdtp.c |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/audio/avdtp.c b/audio/avdtp.c
index 297b578..8e38ccd 100644
--- a/audio/avdtp.c
+++ b/audio/avdtp.c
@@ -1200,6 +1200,7 @@ static gboolean avdtp_setconf_cmd(struct avdtp *session, uint8_t transaction,
 	uint8_t err, category = 0x00;
 	struct audio_device *dev;
 	bdaddr_t src, dst;
+	GSList *l;
 
 	if (size < sizeof(struct setconf_req)) {
 		error("Too short getcap request");
@@ -1247,6 +1248,16 @@ static gboolean avdtp_setconf_cmd(struct avdtp *session, uint8_t transaction,
 					size - sizeof(struct setconf_req),
 					&stream->codec);
 
+	/* Verify that the Media Transport capability's length = 0. Reject otherwise */
+	for (l = stream->caps; l != NULL; l = g_slist_next(l)) {
+		struct avdtp_service_capability *cap = l->data;
+
+		if ((cap->category == AVDTP_MEDIA_TRANSPORT) && (cap->length != 0)) {
+			err = AVDTP_BAD_MEDIA_TRANSPORT_FORMAT;
+			goto failed;
+		}
+	}
+
 	if (sep->ind && sep->ind->set_configuration) {
 		if (!sep->ind->set_configuration(session, sep, stream,
 							stream->caps, &err,
-- 
1.5.5


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

* Re: [PATCH] AVDTP Qualification: Fix error handling for AVDTP set configuration command
  2009-03-25 23:01 ` Marcel Holtmann
@ 2009-03-27  0:43   ` Nick Pelly
  0 siblings, 0 replies; 3+ messages in thread
From: Nick Pelly @ 2009-03-27  0:43 UTC (permalink / raw)
  To: Marcel Holtmann; +Cc: linux-bluetooth

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

On 3/25/09, Marcel Holtmann <marcel@holtmann.org> wrote:
> Hi Nick,
>
>  > +
>  > +               if ((cap->category == AVDTP_MEDIA_TRANSPORT) &&
>  > (cap->length != 0)) {
>  > +                       err = AVDTP_BAD_MEDIA_TRANSPORT_FORMAT;
>  > +                       goto failed;
>
>  no need to put brackets around cap->cat == ... check etc. The comparison
>  takes precedence over &&. Please fix and re-send the patch.

fixed

[-- Attachment #2: 0005-AVDTP-Qualification-Fix-error-handling-for-AVDTP-se.patch --]
[-- Type: text/x-patch, Size: 1369 bytes --]

From f0d527062359212c3506bf2090829406cfd15f0e Mon Sep 17 00:00:00 2001
From: Nick Pelly <npelly@google.com>
Date: Thu, 26 Mar 2009 16:23:25 -0700
Subject: [PATCH] AVDTP Qualification: Fix error handling for AVDTP set configuration command.

---
 audio/avdtp.c |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/audio/avdtp.c b/audio/avdtp.c
index 297b578..7764369 100644
--- a/audio/avdtp.c
+++ b/audio/avdtp.c
@@ -1200,6 +1200,7 @@ static gboolean avdtp_setconf_cmd(struct avdtp *session, uint8_t transaction,
 	uint8_t err, category = 0x00;
 	struct audio_device *dev;
 	bdaddr_t src, dst;
+	GSList *l;
 
 	if (size < sizeof(struct setconf_req)) {
 		error("Too short getcap request");
@@ -1247,6 +1248,16 @@ static gboolean avdtp_setconf_cmd(struct avdtp *session, uint8_t transaction,
 					size - sizeof(struct setconf_req),
 					&stream->codec);
 
+	/* Verify that the Media Transport capability's length = 0. Reject otherwise */
+	for (l = stream->caps; l != NULL; l = g_slist_next(l)) {
+		struct avdtp_service_capability *cap = l->data;
+
+		if (cap->category == AVDTP_MEDIA_TRANSPORT && cap->length != 0) {
+			err = AVDTP_BAD_MEDIA_TRANSPORT_FORMAT;
+			goto failed;
+		}
+	}
+
 	if (sep->ind && sep->ind->set_configuration) {
 		if (!sep->ind->set_configuration(session, sep, stream,
 							stream->caps, &err,
-- 
1.5.5


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

end of thread, other threads:[~2009-03-27  0:43 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-03-26 23:51 [PATCH] AVDTP Qualification: Fix error handling for AVDTP set configuration command Nick Pelly
2009-03-25 23:01 ` Marcel Holtmann
2009-03-27  0:43   ` Nick Pelly

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