Linux bluetooth development
 help / color / mirror / Atom feed
* [PATCH 1/2] Bluetooth: Fix L2CAP nesting level initialization location
@ 2014-11-13  7:46 Johan Hedberg
  2014-11-13  7:46 ` [PATCH 2/2] Bluetooth: Fix correct nesting for 6lowpan server channel Johan Hedberg
  2014-11-13  8:13 ` [PATCH 1/2] Bluetooth: Fix L2CAP nesting level initialization location Marcel Holtmann
  0 siblings, 2 replies; 4+ messages in thread
From: Johan Hedberg @ 2014-11-13  7:46 UTC (permalink / raw)
  To: linux-bluetooth

From: Johan Hedberg <johan.hedberg@intel.com>

There's no reason why all users of L2CAP would need to worry about
initializing chan->nesting to L2CAP_NESTING_NORMAL (which is important
since 0 is the same as NESTING_SMP). This patch moves the initialization
to the common place that's used to create all new channels, i.e. the
l2cap_chan_create() function.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
---
 net/bluetooth/l2cap_core.c | 3 +++
 net/bluetooth/l2cap_sock.c | 3 ---
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c
index fc15174c612c..52e1871d6334 100644
--- a/net/bluetooth/l2cap_core.c
+++ b/net/bluetooth/l2cap_core.c
@@ -424,6 +424,9 @@ struct l2cap_chan *l2cap_chan_create(void)
 
 	mutex_init(&chan->lock);
 
+	/* Set default lock nesting level */
+	atomic_set(&chan->nesting, L2CAP_NESTING_NORMAL);
+
 	write_lock(&chan_list_lock);
 	list_add(&chan->global_l, &chan_list);
 	write_unlock(&chan_list_lock);
diff --git a/net/bluetooth/l2cap_sock.c b/net/bluetooth/l2cap_sock.c
index 7913c28c643d..a5aa9f92b5e2 100644
--- a/net/bluetooth/l2cap_sock.c
+++ b/net/bluetooth/l2cap_sock.c
@@ -1510,9 +1510,6 @@ static void l2cap_sock_init(struct sock *sk, struct sock *parent)
 		l2cap_chan_set_defaults(chan);
 	}
 
-	/* Set default lock nesting level */
-	atomic_set(&chan->nesting, L2CAP_NESTING_NORMAL);
-
 	/* Default config options */
 	chan->flush_to = L2CAP_DEFAULT_FLUSH_TO;
 
-- 
2.1.0


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

end of thread, other threads:[~2014-11-13  8:13 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-11-13  7:46 [PATCH 1/2] Bluetooth: Fix L2CAP nesting level initialization location Johan Hedberg
2014-11-13  7:46 ` [PATCH 2/2] Bluetooth: Fix correct nesting for 6lowpan server channel Johan Hedberg
2014-11-13  8:13   ` Marcel Holtmann
2014-11-13  8:13 ` [PATCH 1/2] Bluetooth: Fix L2CAP nesting level initialization location Marcel Holtmann

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