linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Marcel Holtmann <marcel@holtmann.org>
To: Andrei Emeltchenko <andrei.emeltchenko.news@gmail.com>
Cc: "Gustavo F. Padovan" <gustavo@las.ic.unicamp.br>,
	linux-bluetooth@vger.kernel.org, gustavo@padovan.org
Subject: Re: [PATCH 1/2] Bluetooth: Add locking scheme to timeout callbacks.
Date: Mon, 14 Dec 2009 09:53:03 -0800	[thread overview]
Message-ID: <1260813183.4041.15.camel@localhost.localdomain> (raw)
In-Reply-To: <508e92ca0912140236t2c93a8a1q3aae97cf9e7bdfd@mail.gmail.com>

Hi Andrei,

> > Avoid race conditions when acessing the sock.
> >
> > Signed-off-by: Gustavo F. Padovan <gustavo@las.ic.unicamp.br>
> > ---
> >  net/bluetooth/l2cap.c |    4 ++++
> >  1 files changed, 4 insertions(+), 0 deletions(-)
> >
> > diff --git a/net/bluetooth/l2cap.c b/net/bluetooth/l2cap.c
> > index c04526f..efac637 100644
> > --- a/net/bluetooth/l2cap.c
> > +++ b/net/bluetooth/l2cap.c
> > @@ -1192,6 +1192,7 @@ static void l2cap_monitor_timeout(unsigned long arg)
> >        struct sock *sk = (void *) arg;
> >        u16 control;
> >
> > +       bh_lock_sock(sk);
> >        if (l2cap_pi(sk)->retry_count >= l2cap_pi(sk)->remote_max_tx) {
> >                l2cap_send_disconn_req(l2cap_pi(sk)->conn, sk);
> 
> missing unlock ?
> 
> >                return;
> > @@ -1203,6 +1204,7 @@ static void l2cap_monitor_timeout(unsigned long arg)
> >        control = L2CAP_CTRL_POLL;
> >        control |= L2CAP_SUPER_RCV_READY;
> >        l2cap_send_sframe(l2cap_pi(sk), control);
> > +       bh_unlock_sock(sk);
> >  }
> 
> Please consider following patch:
> 
> --- a/net/bluetooth/l2cap.c
> +++ b/net/bluetooth/l2cap.c
> @@ -1208,6 +1208,7 @@ static void l2cap_monitor_timeout(unsigned long arg)
>         bh_lock_sock(sk);
>         if (l2cap_pi(sk)->retry_count >= l2cap_pi(sk)->remote_max_tx) {
>                 l2cap_send_disconn_req(l2cap_pi(sk)->conn, sk);
> +               bh_unlock_sock(sk);
>                 return;
>         }
> 
> 
> Also see complete patch attached.

I am actually forgiving when people send patches as attachments since
sometimes the corporate email servers are just stupid. However gzipped
patches is where I draw the line. Please re-send it.

Regards

Marcel



  parent reply	other threads:[~2009-12-14 17:53 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-08-24  3:45 [PATCH 1/2] Bluetooth: Add locking scheme to timeout callbacks Gustavo F. Padovan
2009-08-24  3:45 ` [PATCH 2/2] Bluetooth: Use *_unaligned_le{16,32} Gustavo F. Padovan
2009-12-14 10:36 ` [PATCH 1/2] Bluetooth: Add locking scheme to timeout callbacks Andrei Emeltchenko
2009-12-14 14:13   ` Gustavo F. Padovan
2009-12-14 17:53   ` Marcel Holtmann [this message]
2009-12-15  8:03     ` Andrei Emeltchenko

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=1260813183.4041.15.camel@localhost.localdomain \
    --to=marcel@holtmann.org \
    --cc=andrei.emeltchenko.news@gmail.com \
    --cc=gustavo@las.ic.unicamp.br \
    --cc=gustavo@padovan.org \
    --cc=linux-bluetooth@vger.kernel.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).