Linux bluetooth development
 help / color / mirror / Atom feed
* [PATCH] Fix crash when there is no enough space to fragment avdtp packet
@ 2010-08-19 11:01 Luiz Augusto von Dentz
  2010-08-19 11:08 ` Johan Hedberg
  0 siblings, 1 reply; 2+ messages in thread
From: Luiz Augusto von Dentz @ 2010-08-19 11:01 UTC (permalink / raw)
  To: linux-bluetooth

From: Luiz Augusto von Dentz <luiz.dentz-von@nokia.com>

This was catch when running codenomicon tests when the output mtu is not
big enough to stuff fragmented packets.
---
 audio/avdtp.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/audio/avdtp.c b/audio/avdtp.c
index cf07f6c..cc7066f 100644
--- a/audio/avdtp.c
+++ b/audio/avdtp.c
@@ -537,6 +537,12 @@ static gboolean avdtp_send(struct avdtp *session, uint8_t transaction,
 		return try_send(sock, session->buf, sizeof(single) + len);
 	}
 
+	/* Check if there is enough space to start packet */
+	if (session->omtu < sizeof(start)) {
+		error("No enough space to fragment packet");
+		return FALSE;
+	}
+
 	/* Count the number of needed fragments */
 	cont_fragments = (len - (session->omtu - sizeof(start))) /
 					(session->omtu - sizeof(cont)) + 1;
-- 
1.7.0.4


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

* Re: [PATCH] Fix crash when there is no enough space to fragment avdtp packet
  2010-08-19 11:01 [PATCH] Fix crash when there is no enough space to fragment avdtp packet Luiz Augusto von Dentz
@ 2010-08-19 11:08 ` Johan Hedberg
  0 siblings, 0 replies; 2+ messages in thread
From: Johan Hedberg @ 2010-08-19 11:08 UTC (permalink / raw)
  To: Luiz Augusto von Dentz; +Cc: linux-bluetooth

Hi Luiz,

On Thu, Aug 19, 2010, Luiz Augusto von Dentz wrote:
> From: Luiz Augusto von Dentz <luiz.dentz-von@nokia.com>
> 
> This was catch when running codenomicon tests when the output mtu is not
> big enough to stuff fragmented packets.
> ---
>  audio/avdtp.c |    6 ++++++
>  1 files changed, 6 insertions(+), 0 deletions(-)

Thanks. The patch has been pushed upstream.

Johan

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

end of thread, other threads:[~2010-08-19 11:08 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-08-19 11:01 [PATCH] Fix crash when there is no enough space to fragment avdtp packet Luiz Augusto von Dentz
2010-08-19 11:08 ` Johan Hedberg

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