public inbox for linux-bluetooth@vger.kernel.org
 help / color / mirror / Atom feed
From: Nick Pelly <npelly@google.com>
To: Marcel Holtmann <marcel@holtmann.org>
Cc: linux-bluetooth@vger.kernel.org
Subject: Re: [PATCH] AVDTP Qualification: Fix error handling for AVDTP set configuration command
Date: Thu, 26 Mar 2009 17:43:10 -0700	[thread overview]
Message-ID: <35c90d960903261743p451f2792rf03d9e6ce593dc6d@mail.gmail.com> (raw)
In-Reply-To: <1238022096.8206.1.camel@localhost.localdomain>

[-- 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


      reply	other threads:[~2009-03-27  0:43 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=35c90d960903261743p451f2792rf03d9e6ce593dc6d@mail.gmail.com \
    --to=npelly@google.com \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=marcel@holtmann.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox