public inbox for linux-bluetooth@vger.kernel.org
 help / color / mirror / Atom feed
From: Marcel Holtmann <marcel@holtmann.org>
To: Luiz Augusto von Dentz <luiz.dentz@gmail.com>
Cc: linux-bluetooth@vger.kernel.org
Subject: Re: regression introduced on v2.6.30-rc1
Date: Sun, 21 Jun 2009 21:04:56 +0200	[thread overview]
Message-ID: <1245611096.15367.76.camel@violet> (raw)
In-Reply-To: <2d5a2c100906211047n31b9d4dajac290601c184380b@mail.gmail.com>

Hi Luiz,

> > did you actually test this change? And understand it?
> >
> 
> Yep, this was actually one of my first attempts to fix the problem and
> it make no difference, but the real problem is not rfcomm_dlc
> reference being hold it is currently rfcomm_session reference which
> are not released until the remote device respond with DISC dlci 0, but
> in case where the remote never respond this reference will be held
> forever which cause the ACL to never be disconnected.
> 
> There is 2 session reference being hold, one by rfcomm_dlc_link
> (core.c:321) which rfcomm_dlc_unlink should takes care and another one
> created on rfcomm_accept_connection (core.c:1837) which afaik won't go
> away if the remote device doesn't respond with a proper DISC to dlci
> 0.

stupid specification. It is just bloody stupid that we have to cleanup
someone else's stuff that we haven't initiated in the first place :(

diff --git a/net/bluetooth/rfcomm/core.c b/net/bluetooth/rfcomm/core.c
index 374536e..864c3c4 100644
--- a/net/bluetooth/rfcomm/core.c
+++ b/net/bluetooth/rfcomm/core.c
@@ -466,6 +466,11 @@ static int __rfcomm_dlc_close(struct rfcomm_dlc *d, int err)
 
                skb_queue_purge(&d->tx_queue);
                rfcomm_dlc_unlink(d);
+
+               /* Specification demands to cleanup after remote
+                * initiated session when closing last DLC */
+               if (list_empty(&s->dlcs))
+                       rfcomm_session_put(s);
        }
 

The patch above should actually fix this, but it is neither compile nor
runtime tested.

If it actually break outgoing connections, which it might, then we have
to add a !d->out to the if statement here and move the whole statement
before rfcomm_dlc_unlink and skb_queue_purge. That is fine anyway since
the rfcomm_dlc_link will always hold at least one session reference
count.

Regards

Marcel



  reply	other threads:[~2009-06-21 19:04 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-06-09 13:17 regression introduced on v2.6.30-rc1 Luiz Augusto von Dentz
2009-06-21 14:08 ` Luiz Augusto von Dentz
2009-06-21 14:48   ` Marcel Holtmann
2009-06-21 16:30     ` Luiz Augusto von Dentz
2009-06-21 16:58       ` Marcel Holtmann
2009-06-21 17:47         ` Luiz Augusto von Dentz
2009-06-21 19:04           ` Marcel Holtmann [this message]
2009-06-22 21:49             ` Luiz Augusto von Dentz
2009-06-22 23:08               ` Luiz Augusto von Dentz
2009-06-23 13:51                 ` Luiz Augusto von Dentz
2009-06-23 14:40                   ` Marcel Holtmann
2009-06-23 15:01                     ` Luiz Augusto von Dentz
2009-06-23 15:06                       ` Marcel Holtmann
2009-06-23 18:04                     ` Stefan Seyfried
2009-06-23 18:13                       ` Luiz Augusto von Dentz
2009-06-23 18:56                         ` Luiz Augusto von Dentz
2009-06-25 13:14                           ` Luiz Augusto von Dentz
2009-06-30 20:18                             ` Luiz Augusto von Dentz

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=1245611096.15367.76.camel@violet \
    --to=marcel@holtmann.org \
    --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