public inbox for linux-bluetooth@vger.kernel.org
 help / color / mirror / Atom feed
From: "Gustavo F. Padovan" <gustavo@las.ic.unicamp.br>
To: Marcel Holtmann <marcel@holtmann.org>
Cc: linux-bluetooth@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/3] bluetooth: add write_lock_bh to __l2cap_chan_link
Date: Sat, 28 Feb 2009 18:49:02 -0300	[thread overview]
Message-ID: <6b53b1990902281349m2c2ed590h6264863ce415b7af@mail.gmail.com> (raw)
In-Reply-To: <1235856798.6074.34.camel@localhost.localdomain>

On Sat, Feb 28, 2009 at 6:33 PM, Marcel Holtmann <marcel@holtmann.org> wrot=
e:
> Hi Gustavo,
>
>> fix race condition
>>
>> Signed-off-by: Gustavo F. Padovan <gustavo@las.ic.unicamp.br>
>> ---
>> =A0net/bluetooth/l2cap.c | =A0 =A02 ++
>> =A01 files changed, 2 insertions(+), 0 deletions(-)
>>
>> diff --git a/net/bluetooth/l2cap.c b/net/bluetooth/l2cap.c
>> index ca4d3b4..355f375 100644
>> --- a/net/bluetooth/l2cap.c
>> +++ b/net/bluetooth/l2cap.c
>> @@ -175,12 +175,14 @@ static inline void __l2cap_chan_link(struct l2cap_=
chan_list *l, struct sock *sk)
>> =A0{
>> =A0 =A0 =A0 sock_hold(sk);
>>
>> + =A0 =A0 write_lock_bh(&l->lock);
>> =A0 =A0 =A0 if (l->head)
>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 l2cap_pi(l->head)->prev_c =3D sk;
>>
>> =A0 =A0 =A0 l2cap_pi(sk)->next_c =3D l->head;
>> =A0 =A0 =A0 l2cap_pi(sk)->prev_c =3D NULL;
>> =A0 =A0 =A0 l->head =3D sk;
>> + =A0 =A0 write_unlock_bh(&l->lock);
>> =A0}
>
> a general rule of thumb is that function starting with __ are the ones
> that don't use any kind of locking.

Ok. I noted this after send the patch. :-(

>
> Regards
>
> Marcel
>
>
>



--=20
Gustavo F. Padovan

Computer Engineering Student
Institute of Computing - IC
University of Campinas - UNICAMP

email: gustavo@las.ic.unicamp.br
gtalk: gfpadovan@gmail.com
mobile: +55 19 81030803

      reply	other threads:[~2009-02-28 21:49 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-02-28  5:02 [PATCH 1/3] bluetooth: add write_lock_bh to __l2cap_chan_link Gustavo F. Padovan
2009-02-28  5:02 ` [PATCH 2/3] bluetooth: add macros for cid channel numbers Gustavo F. Padovan
2009-02-28  5:02   ` [PATCH 3/3] bluetooth: use L2CAP_CID_* macros Gustavo F. Padovan
2009-02-28 21:31     ` Marcel Holtmann
2009-02-28 21:30   ` [PATCH 2/3] bluetooth: add macros for cid channel numbers Marcel Holtmann
2009-02-28  5:54 ` [PATCH 1/3] bluetooth: add write_lock_bh to __l2cap_chan_link Gustavo F. Padovan
2009-02-28 21:33 ` Marcel Holtmann
2009-02-28 21:49   ` Gustavo F. Padovan [this message]

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=6b53b1990902281349m2c2ed590h6264863ce415b7af@mail.gmail.com \
    --to=gustavo@las.ic.unicamp.br \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=linux-kernel@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