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

* [PATCH 2/2] Bluetooth: Fix correct nesting for 6lowpan server channel
  2014-11-13  7:46 [PATCH 1/2] Bluetooth: Fix L2CAP nesting level initialization location Johan Hedberg
@ 2014-11-13  7:46 ` 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
  1 sibling, 1 reply; 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>

Server channels in BT_LISTEN state should use L2CAP_NESTING_PARENT. This
patch fixes the nesting value for the 6lowpan channel.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
---
 net/bluetooth/6lowpan.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/net/bluetooth/6lowpan.c b/net/bluetooth/6lowpan.c
index 3d8ceb251d75..bdcaefd2db12 100644
--- a/net/bluetooth/6lowpan.c
+++ b/net/bluetooth/6lowpan.c
@@ -1130,6 +1130,8 @@ static struct l2cap_chan *bt_6lowpan_listen(void)
 	pchan->state = BT_LISTEN;
 	pchan->src_type = BDADDR_LE_PUBLIC;
 
+	atomic_set(&pchan->nesting, L2CAP_NESTING_PARENT);
+
 	BT_DBG("psm 0x%04x chan %p src type %d", psm_6lowpan, pchan,
 	       pchan->src_type);
 
-- 
2.1.0


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

* Re: [PATCH 2/2] Bluetooth: Fix correct nesting for 6lowpan server channel
  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
  0 siblings, 0 replies; 4+ messages in thread
From: Marcel Holtmann @ 2014-11-13  8:13 UTC (permalink / raw)
  To: Johan Hedberg; +Cc: linux-bluetooth

Hi Johan,

> Server channels in BT_LISTEN state should use L2CAP_NESTING_PARENT. This
> patch fixes the nesting value for the 6lowpan channel.
> 
> Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
> ---
> net/bluetooth/6lowpan.c | 2 ++
> 1 file changed, 2 insertions(+)

patch has been applied to bluetooth-next tree.

Regards

Marcel


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

* Re: [PATCH 1/2] Bluetooth: Fix L2CAP nesting level initialization location
  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
  1 sibling, 0 replies; 4+ messages in thread
From: Marcel Holtmann @ 2014-11-13  8:13 UTC (permalink / raw)
  To: Johan Hedberg; +Cc: linux-bluetooth

Hi Johan,

> 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(-)

patch has been applied to bluetooth-next tree.

Regards

Marcel


^ permalink raw reply	[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