[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <6b53b1990902281349m2c2ed590h6264863ce415b7af@mail.gmail.com>
Date:	Sat, 28 Feb 2009 18:49:02 -0300
From:	"Gustavo F. Padovan" <gustavo@....ic.unicamp.br>
To:	Marcel Holtmann <marcel@...tmann.org>
Cc:	linux-bluetooth@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 1/3] bluetooth: add write_lock_bh to __l2cap_chan_link
On Sat, Feb 28, 2009 at 6:33 PM, Marcel Holtmann <marcel@...tmann.org> wrote:
> Hi Gustavo,
>
>> fix race condition
>>
>> Signed-off-by: Gustavo F. Padovan <gustavo@....ic.unicamp.br>
>> ---
>>  net/bluetooth/l2cap.c |    2 ++
>>  1 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)
>>  {
>>       sock_hold(sk);
>>
>> +     write_lock_bh(&l->lock);
>>       if (l->head)
>>               l2cap_pi(l->head)->prev_c = sk;
>>
>>       l2cap_pi(sk)->next_c = l->head;
>>       l2cap_pi(sk)->prev_c = NULL;
>>       l->head = sk;
>> +     write_unlock_bh(&l->lock);
>>  }
>
> 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
>
>
>
-- 
Gustavo F. Padovan
Computer Engineering Student
Institute of Computing - IC
University of Campinas - UNICAMP
email: gustavo@....ic.unicamp.br
gtalk: gfpadovan@...il.com
mobile: +55 19 81030803
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/
Powered by blists - more mailing lists
 
