Bluetooth: Fix L2CAP nesting level initialization location
Subsystems (2)
PATCH 1/2 Bluetooth: Fix L2CAP nesting level initialization location
From: Johan Hedberg <[email protected]>
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.
--- net/bluetooth/l2cap_core.c | 3 +++ net/bluetooth/l2cap_sock.c | 3 --- 2 files changed, 3 insertions(+), 3 deletions(-)
net/bluetooth/l2cap_core.c +3 -0
@@ -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);
net/bluetooth/l2cap_sock.c +0 -3
@@ -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 ;
Signature · 1 line
2.1.0
PATCH 2/2 Bluetooth: Fix correct nesting for 6lowpan server channel
From: Johan Hedberg <[email protected]>
Server channels in BT_LISTEN state should use L2CAP_NESTING_PARENT. This patch fixes the nesting value for the 6lowpan channel.
--- net/bluetooth/6lowpan.c | 2 ++ 1 file changed, 2 insertions(+)
net/bluetooth/6lowpan.c +2 -0
@@ -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);
Signature · 1 line
2.1.0
Marcel Holtmann
maintainerRe: [PATCH 2/2] Bluetooth: Fix correct nesting for 6lowpan server channel
Hi Johan,
Quoted 7 lines
Server channels in
BT_LISTENstate should useL2CAP_NESTING_PARENT. This patch fixes the nesting value for the 6lowpan channel.Signed-off-by Johan Hedberg <[email protected]>---
net/bluetooth/6lowpan.c| 2 ++1 file changed, 2 insertions(+)
patch has been applied to bluetooth-next tree.
Regards
Marcel
Marcel Holtmann
maintainerHi Johan,
Quoted 11 lines
There's no reason why all users of L2CAP would need to worry about initializing
chan->nestingtoL2CAP_NESTING_NORMAL(which is important since 0 is the same asNESTING_SMP). This patch moves the initialization to the common place that's used to create all new channels, i.e. thel2cap_chan_create()function.Signed-off-by Johan Hedberg <[email protected]>---
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