linux-bluetooth.vger.kernel.org archive mirror
 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: bug? kernel does not send HCI Create Connection Cancel Command on shutdown() or close() of a connecting rfcomm socket
Date: Thu, 9 Jul 2009 12:37:49 -0700	[thread overview]
Message-ID: <35c90d960907091237o72228b0v57ad2556d77f4857@mail.gmail.com> (raw)
In-Reply-To: <35c90d960907061155t7349cc90p2e58a09a310b8926@mail.gmail.com>

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

For the RFCOMM issue.

This is the log when shutdown() is called on the rfcomm socket while
the ACL link is connecting:

[  132.856414] rfcomm:rfcomm_sock_shutdown: sock c5cb3a20, sk c63fca00
[  132.856933] rfcomm:__rfcomm_sock_close: sk c63fca00 state 5 socket c5cb3a20
[  132.857788] rfcomm:__rfcomm_dlc_close: dlc c61ea240 state 7 dlci 38
err 0 session c63d4ba0
[  132.858612] rfcomm:rfcomm_send_disc: c63d4ba0 dlci 38
[  132.859069] rfcomm:rfcomm_send_frame: session c63d4ba0 len 4
[  132.859893] l2cap:l2cap_sock_sendmsg: sock c5cb38c0, sk c63fc800
[  132.860351] rfcomm:rfcomm_dlc_set_timer: dlc c61ea240 state 8 timeout 2000
[  133.863739] rfcomm:rfcomm_sock_release: sock c5cb3a20, sk c63fca00
[  133.864257] rfcomm:rfcomm_sock_shutdown: sock c5cb3a20, sk c63fca00
[  133.865081] rfcomm:rfcomm_sock_kill: sk c63fca00 state 5 refcnt 2
[  133.865539] rfcomm:rfcomm_sock_destruct: sk c63fca00 dlc c61ea240



I'm surprised to see d->state for the rfcomm_dlc is BT_CONFIG at
__rfcomm_dlc_close(), but looking at __rfcomm_dlc_open() this appears
to be intentional.

We do not hit __l2cap_sock_close()

We attempt a graceful rfcomm disconnected by sending the dlci
disconnected frame - but this does not make sense - since there is no
rfcomm connection yet.


Assuming that d->state == BT_CONFIG during this phase is correct, then
the attached patch will fix this issue.

However - I don't know the rfcomm state machine - so this patch may
having side effects. Requesting comments.

Nick

[-- Attachment #2: 0001-Bluetooth-Do-not-attempt-to-send-dlci-disconnect-whe.patch --]
[-- Type: text/x-patch, Size: 973 bytes --]

From d90a0cd7a0219808e8183eb74f76a61d043ab4c2 Mon Sep 17 00:00:00 2001
From: Nick Pelly <npelly@google.com>
Date: Thu, 9 Jul 2009 12:23:44 -0700
Subject: [PATCH] Bluetooth: Do not attempt to send dlci disconnect when in BT_CONFIG.

This fixes a bug where shutdown() and close() on a rfcomm socket during ACL
connection would not cause HCI Create Connection Cancel.

Signed-off-by: Nick Pelly <npelly@google.com>
---
 net/bluetooth/rfcomm/core.c |    1 -
 1 files changed, 0 insertions(+), 1 deletions(-)

diff --git a/net/bluetooth/rfcomm/core.c b/net/bluetooth/rfcomm/core.c
index 1d0fb0f..c109a3a 100644
--- a/net/bluetooth/rfcomm/core.c
+++ b/net/bluetooth/rfcomm/core.c
@@ -428,7 +428,6 @@ static int __rfcomm_dlc_close(struct rfcomm_dlc *d, int err)
 
 	switch (d->state) {
 	case BT_CONNECT:
-	case BT_CONFIG:
 		if (test_and_clear_bit(RFCOMM_DEFER_SETUP, &d->flags)) {
 			set_bit(RFCOMM_AUTH_REJECT, &d->flags);
 			rfcomm_schedule(RFCOMM_SCHED_AUTH);
-- 
1.6.3.1


  parent reply	other threads:[~2009-07-09 19:37 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-05-20  1:20 bug? kernel does not send HCI Create Connection Cancel Command on shutdown() or close() of a connecting rfcomm socket Nick Pelly
2009-05-20  2:49 ` Marcel Holtmann
2009-05-20 21:57   ` Nick Pelly
2009-07-06 18:55     ` Nick Pelly
2009-07-06 23:31       ` Marcel Holtmann
2009-07-09 19:37       ` Nick Pelly [this message]
2009-07-13 15:46         ` Nick Pelly
2009-07-13 21:27           ` Luiz Augusto von Dentz
2009-07-14 16:15             ` Nick Pelly
2009-07-15 22:11               ` Nick Pelly
2009-08-06 18:03                 ` Nick Pelly
2010-02-03  1:54                   ` Nick Pelly
2010-02-03  1:56                   ` Nick Pelly

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=35c90d960907091237o72228b0v57ad2556d77f4857@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;
as well as URLs for NNTP newsgroup(s).