Linux bluetooth development
 help / color / mirror / Atom feed
* [PATCH 1/2] Bluetooth: Fix L2CAP ERTM packet queue corruption
@ 2012-04-25  8:29 Manoj
  2012-04-25  8:29 ` [PATCH 2/2] Bluetooth: Fix retransmission of ERTM packets Manoj
  2012-04-25  8:46 ` [PATCH 1/2] Bluetooth: Fix L2CAP ERTM packet queue corruption Andrei Emeltchenko
  0 siblings, 2 replies; 10+ messages in thread
From: Manoj @ 2012-04-25  8:29 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Anurag Gupta, Manoj

While running in L2CAP ERTM mode, sometimes ERTM packet queue
gets corrupted because though method l2cap_ertm_send() is not
thread-safe, it is called simultaneously from multiple
threads.

Signed-off-by: Manoj <manojkr.sharma@stericsson.com>
---
 net/bluetooth/l2cap_core.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c
index 19807c9..a9319e2 100644
--- a/net/bluetooth/l2cap_core.c
+++ b/net/bluetooth/l2cap_core.c
@@ -1713,6 +1713,7 @@ static int l2cap_ertm_send(struct l2cap_chan *chan)
 	if (chan->state != BT_CONNECTED)
 		return -ENOTCONN;
 
+	mutex_lock(&chan->conn->chan_lock);
 	while ((skb = chan->tx_send_head) && (!l2cap_tx_window_full(chan))) {
 
 		if (chan->remote_max_tx &&
@@ -1765,7 +1766,7 @@ static int l2cap_ertm_send(struct l2cap_chan *chan)
 		else
 			chan->tx_send_head = skb_queue_next(&chan->tx_q, skb);
 	}
-
+	mutex_unlock(&chan->conn->chan_lock);
 	return nsent;
 }
 
-- 
1.6.6.1


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

end of thread, other threads:[~2013-01-13 18:35 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-04-25  8:29 [PATCH 1/2] Bluetooth: Fix L2CAP ERTM packet queue corruption Manoj
2012-04-25  8:29 ` [PATCH 2/2] Bluetooth: Fix retransmission of ERTM packets Manoj
2012-04-25 15:33   ` Mat Martineau
2012-04-25 17:29     ` Manoj Sharma
2013-01-11  8:32     ` Obexd OPP filesend fails with Windows7 stack Syam Sidhardhan
2013-01-13 15:42       ` Luiz Augusto von Dentz
2013-01-13 18:35         ` Syam Sidhardhan
2012-04-25  8:46 ` [PATCH 1/2] Bluetooth: Fix L2CAP ERTM packet queue corruption Andrei Emeltchenko
2012-04-25 16:05   ` Mat Martineau
2012-04-25 17:26     ` Manoj Sharma

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox