public inbox for linux-bluetooth@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/3] bluetooth: add write_lock_bh to __l2cap_chan_link
@ 2009-02-28  5:02 Gustavo F. Padovan
  2009-02-28  5:02 ` [PATCH 2/3] bluetooth: add macros for cid channel numbers Gustavo F. Padovan
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Gustavo F. Padovan @ 2009-02-28  5:02 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: linux-kernel

fix race condition

Signed-off-by: Gustavo F. Padovan <gustavo@las.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);
 }
 
 static inline void l2cap_chan_unlink(struct l2cap_chan_list *l, struct sock *sk)
-- 
1.6.0.6


^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2009-02-28 21:49 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox