Bluetooth: Fix LE L2CAP Connect Request handling together with SMP
authorJohan Hedberg <johan.hedberg@intel.com>
Mon, 2 Dec 2013 20:12:22 +0000 (22:12 +0200)
committerMarcel Holtmann <marcel@holtmann.org>
Thu, 5 Dec 2013 15:05:35 +0000 (07:05 -0800)
Unlike BR/EDR, for LE when we're in the BT_CONNECT state we may or may
not have already have sent the Connect Request. This means that we need
some extra tracking of the request. This patch adds an extra channel
flag to prevent the request from being sent a second time.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
include/net/bluetooth/l2cap.h
net/bluetooth/l2cap_core.c

index b0d7e4adb167d99b8c853d18d02609298e313d82..292749c0f4bc3caa074f044f3beec2adcaacc192 100644 (file)
@@ -695,6 +695,7 @@ enum {
        FLAG_EXT_CTRL,
        FLAG_EFS_ENABLE,
        FLAG_DEFER_SETUP,
+       FLAG_LE_CONN_REQ_SENT,
 };
 
 enum {
index 1c94e51a28fed0b2f5cced0031c13ab613b960b0..407e9d61d061697a7d17c1b2773c2c2c00f474e0 100644 (file)
@@ -1223,6 +1223,9 @@ static void l2cap_le_connect(struct l2cap_chan *chan)
        struct l2cap_conn *conn = chan->conn;
        struct l2cap_le_conn_req req;
 
+       if (test_and_set_bit(FLAG_LE_CONN_REQ_SENT, &chan->flags))
+               return;
+
        req.psm     = chan->psm;
        req.scid    = cpu_to_le16(chan->scid);
        req.mtu     = cpu_to_le16(chan->imtu);