All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Bluetooth: Fix removing of dlc timer with DEFER_SETUP
@ 2009-03-26 14:54 Johan Hedberg
  0 siblings, 0 replies; only message in thread
From: Johan Hedberg @ 2009-03-26 14:54 UTC (permalink / raw)
  To: linux-bluetooth

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

Hi,

There seems to be a missing call to rfcomm_dlc_clear_timer when accepting
RFCOMM connections for a socket with DEFER_SETUP. This is easily noticable with
several headsets by them getting disconnected after about 20 seconds even
though the connection from them has been properly accepted on the userspace
side by bluetoothd.

I'm not 100% sure of the correctness of this patch regarding the placement of
this rfcomm_dlc_clear_timer call but it seems to do the trick. What also makes
me a little uncertain is that the issue is not reproducable with some headsets
so there must be *some* code path for accepting connections that does work.
With most dual-profile headsets or those that do more advanced SDP stuff during
the connection setup this is fairly easily reproducable though.

So, any comments about the patch are welcome.

Johan

[-- Attachment #2: 0001-Bluetooth-Fix-removing-of-dlc-timer-with-DEFER_SETU.patch --]
[-- Type: text/x-diff, Size: 1131 bytes --]

>From d60c77fd23b4f5043351829c6f0213f5230360d6 Mon Sep 17 00:00:00 2001
From: Johan Hedberg <johan.hedberg@nokia.com>
Date: Thu, 26 Mar 2009 16:41:56 +0200
Subject: [PATCH] Bluetooth: Fix removing of dlc timer with DEFER_SETUP

There's a missing call to rfcomm_dlc_clear_timer in the case that DEFER_SETUP
is used and so the connection gets disconnected after the timeout even if it
was successfully accepted previously.

This patch adds a call to rfcomm_dlc_clear_timer to rfcomm_dlc_accept which
will get called when the user accepts the connection by calling read() on the
socket.

Signed-off-by: Johan Hedberg <johan.hedberg@nokia.com>
---
 net/bluetooth/rfcomm/core.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/net/bluetooth/rfcomm/core.c b/net/bluetooth/rfcomm/core.c
index 1d0fb0f..374536e 100644
--- a/net/bluetooth/rfcomm/core.c
+++ b/net/bluetooth/rfcomm/core.c
@@ -1194,6 +1194,8 @@ void rfcomm_dlc_accept(struct rfcomm_dlc *d)
 
 	rfcomm_send_ua(d->session, d->dlci);
 
+	rfcomm_dlc_clear_timer(d);
+
 	rfcomm_dlc_lock(d);
 	d->state = BT_CONNECTED;
 	d->state_change(d, 0);
-- 
1.6.0.4


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2009-03-26 14:54 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-03-26 14:54 [PATCH] Bluetooth: Fix removing of dlc timer with DEFER_SETUP Johan Hedberg

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.