public inbox for linux-bluetooth@vger.kernel.org
 help / color / mirror / Atom feed
From: "Daniel Örstadius" <daniel.orstadius@gmail.com>
To: Luiz Augusto von Dentz <luiz.dentz@gmail.com>,
	linux-bluetooth@vger.kernel.org
Subject: Re: [PATCH] AVDTP start/stop handling during disconnection
Date: Tue, 1 Sep 2009 14:09:01 +0300	[thread overview]
Message-ID: <eb7933e20909010409x4b85fa1bt162e52ecce028310@mail.gmail.com> (raw)
In-Reply-To: <20090901070204.GA27211@jh-x301>

On Tue, Sep 1, 2009 at 10:02 AM, Johan Hedberg<johan.hedberg@nokia.com> wrote:

> So Daniel, could you split out the first part of your patch and resend it?


>From 627850090c93152b8faa3e4a724df24dbc556d4e Mon Sep 17 00:00:00 2001
From: Daniel Orstadius <daniel.orstadius@gmail.com>
Date: Tue, 1 Sep 2009 13:55:44 +0300
Subject: [PATCH] Reject AVDTP START/STOP when disconnecting

---
 audio/avdtp.c |   19 +++++++++++++++++--
 1 files changed, 17 insertions(+), 2 deletions(-)

diff --git a/audio/avdtp.c b/audio/avdtp.c
index 8046dda..839f035 100644
--- a/audio/avdtp.c
+++ b/audio/avdtp.c
@@ -2223,9 +2223,12 @@ static gboolean request_timeout(gpointer user_data)
 		break;
 	case AVDTP_CLOSE:
 		error("Close request timed out");
-		if (lsep && lsep->cfm && lsep->cfm->close)
+		if (lsep && lsep->cfm && lsep->cfm->close) {
 			lsep->cfm->close(session, lsep, stream, &err,
 						lsep->user_data);
+			if (stream)
+				stream->close_int = FALSE;
+		}
 		break;
 	case AVDTP_SET_CONFIGURATION:
 		error("SetConfiguration request timed out");
@@ -2675,9 +2678,11 @@ static gboolean avdtp_parse_rej(struct avdtp *session,
 			return FALSE;
 		error("CLOSE request rejected: %s (%d)",
 				avdtp_strerror(&err), err.err.error_code);
-		if (sep && sep->cfm && sep->cfm->close)
+		if (sep && sep->cfm && sep->cfm->close) {
 			sep->cfm->close(session, sep, stream, &err,
 					sep->user_data);
+			stream->close_int = FALSE;
+		}
 		return TRUE;
 	case AVDTP_ABORT:
 		if (!stream_rej_to_err(buf, size, &err, &acp_seid))
@@ -3138,6 +3143,11 @@ int avdtp_start(struct avdtp *session, struct
avdtp_stream *stream)
 	if (stream->lsep->state != AVDTP_STATE_OPEN)
 		return -EINVAL;

+	if (stream->close_int == TRUE) {
+		error("avdtp_start: rejecting start since close is initiated");
+		return -EINVAL;
+	}
+
 	memset(&req, 0, sizeof(req));
 	req.first_seid.seid = stream->rseid;

@@ -3156,6 +3166,11 @@ int avdtp_close(struct avdtp *session, struct
avdtp_stream *stream)
 	if (stream->lsep->state < AVDTP_STATE_OPEN)
 		return -EINVAL;

+	if (stream->close_int == TRUE) {
+		error("avdtp_close: rejecting close since it is already inititated");
+		return -EINVAL;
+	}
+
 	memset(&req, 0, sizeof(req));
 	req.acp_seid = stream->rseid;

-- 
1.6.0.4


Thanks for the feedback.

/Daniel

  reply	other threads:[~2009-09-01 11:09 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-08-27 15:24 [PATCH] AVDTP start/stop handling during disconnection Daniel Örstadius
2009-08-27 17:08 ` Luiz Augusto von Dentz
2009-09-01  7:02   ` Johan Hedberg
2009-09-01 11:09     ` Daniel Örstadius [this message]
2009-09-02 10:06       ` Johan Hedberg

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=eb7933e20909010409x4b85fa1bt162e52ecce028310@mail.gmail.com \
    --to=daniel.orstadius@gmail.com \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=luiz.dentz@gmail.com \
    /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