aboutsummaryrefslogtreecommitdiffstats
path: root/net/bluetooth/l2cap_core.c
diff options
context:
space:
mode:
authorJohan Hedberg <johan.hedberg@intel.com>2014-11-13 09:46:04 +0200
committerMarcel Holtmann <marcel@holtmann.org>2014-11-13 09:11:37 +0100
commitff714119a6d2e2fc3c2e046d77801afa83a9ace2 (patch)
treeaeccaf567640d699bd86382307df529b8544e407 /net/bluetooth/l2cap_core.c
parentBluetooth: Fix L2CAP socket lock nesting level (diff)
downloadlinux-dev-ff714119a6d2e2fc3c2e046d77801afa83a9ace2.tar.xz
linux-dev-ff714119a6d2e2fc3c2e046d77801afa83a9ace2.zip
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: Johan Hedberg <johan.hedberg@intel.com> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Diffstat (limited to 'net/bluetooth/l2cap_core.c')
-rw-r--r--net/bluetooth/l2cap_core.c3
1 files changed, 3 insertions, 0 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);