Commit ff714119 authored by Johan Hedberg's avatar Johan Hedberg Committed by Marcel Holtmann

Bluetooth: Fix L2CAP nesting level initialization location

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: default avatarJohan Hedberg <johan.hedberg@intel.com>
Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
parent 3b2ab39e
...@@ -424,6 +424,9 @@ struct l2cap_chan *l2cap_chan_create(void) ...@@ -424,6 +424,9 @@ struct l2cap_chan *l2cap_chan_create(void)
mutex_init(&chan->lock); mutex_init(&chan->lock);
/* Set default lock nesting level */
atomic_set(&chan->nesting, L2CAP_NESTING_NORMAL);
write_lock(&chan_list_lock); write_lock(&chan_list_lock);
list_add(&chan->global_l, &chan_list); list_add(&chan->global_l, &chan_list);
write_unlock(&chan_list_lock); write_unlock(&chan_list_lock);
......
...@@ -1510,9 +1510,6 @@ static void l2cap_sock_init(struct sock *sk, struct sock *parent) ...@@ -1510,9 +1510,6 @@ static void l2cap_sock_init(struct sock *sk, struct sock *parent)
l2cap_chan_set_defaults(chan); l2cap_chan_set_defaults(chan);
} }
/* Set default lock nesting level */
atomic_set(&chan->nesting, L2CAP_NESTING_NORMAL);
/* Default config options */ /* Default config options */
chan->flush_to = L2CAP_DEFAULT_FLUSH_TO; chan->flush_to = L2CAP_DEFAULT_FLUSH_TO;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment