linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Gustavo F. Padovan" <padovan@profusion.mobi>
To: Suraj Sumangala <suraj@Atheros.com>
Cc: Suraj Sumangala <Suraj.Sumangala@Atheros.com>,
	"linux-bluetooth@vger.kernel.org"
	<linux-bluetooth@vger.kernel.org>,
	Jothikumar Mothilal <Jothikumar.Mothilal@Atheros.com>
Subject: Re: [RFC] Bluetooth: process received S-frames when socket is locked by user process
Date: Wed, 2 Feb 2011 15:41:14 -0200	[thread overview]
Message-ID: <20110202174114.GI2273@joana> (raw)
In-Reply-To: <4D4995D7.6070408@Atheros.com>

Hi Suraj,

* Suraj Sumangala <suraj@Atheros.com> [2011-02-02 23:05:19 +0530]:

> Hi Gustavo,
> 
> On 2/2/2011 10:21 PM, Gustavo F. Padovan wrote:
> > This one: e454c844644683571617896ab2a4ce0109c1943e
> >
> > The issue fixed by this patch is very similar to what you reported
> 
> Is this commit available in 
> "git://git.kernel.org/pub/scm/linux/kernel/git/padovan/bluetooth-next-2.6.git" 
> tree?

Yes, it is also available in Linus' tree.

commit e454c844644683571617896ab2a4ce0109c1943e
Author: Gustavo F. Padovan <padovan@profusion.mobi>
Date:   Tue Sep 21 16:31:11 2010 -0300

    Bluetooth: Fix deadlock in the ERTM logic
    
    The Enhanced Retransmission Mode(ERTM) is a realiable mode of operation
    of the Bluetooth L2CAP layer. Think on it like a simplified version of
    TCP.
    The problem we were facing here was a deadlock. ERTM uses a backlog
    queue to queue incomimg packets while the user is helding the lock. At
    some moment the sk_sndbuf can be exceeded and we can't alloc new skbs
    then the code sleep with the lock to wait for memory, that stalls the
    ERTM connection once we can't read the acknowledgements packets in the
    backlog queue to free memory and make the allocation of outcoming skb
    successful.
    successful.
    
    This patch actually affect all users of bt_skb_send_alloc(), i.e., all
    L2CAP modes and SCO.
    
    We are safe against socket states changes or channels deletion while the
    we are sleeping wait memory. Checking for the sk->sk_err and
    sk->sk_shutdown make the code safe, since any action that can leave the
    socket or the channel in a not usable state set one of the struct
    members at least. Then we can check both of them when getting the lock
    again and return with the proper error if something unexpected happens.
    
    Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
    Signed-off-by: Ulisses Furquim <ulisses@profusion.mobi>



-- 
Gustavo F. Padovan
http://profusion.mobi

  reply	other threads:[~2011-02-02 17:41 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-31 13:12 [RFC] Bluetooth: process received S-frames when socket is locked by user process Suraj Sumangala
2011-02-02 16:28 ` Gustavo F. Padovan
2011-02-02 16:34   ` Suraj Sumangala
2011-02-02 16:51     ` Gustavo F. Padovan
2011-02-02 17:35       ` Suraj Sumangala
2011-02-02 17:41         ` Gustavo F. Padovan [this message]
2011-02-03  6:50           ` Suraj Sumangala

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=20110202174114.GI2273@joana \
    --to=padovan@profusion.mobi \
    --cc=Jothikumar.Mothilal@Atheros.com \
    --cc=Suraj.Sumangala@Atheros.com \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=suraj@Atheros.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;
as well as URLs for NNTP newsgroup(s).