summaryrefslogtreecommitdiff
path: root/net
diff options
context:
space:
mode:
authorSzymon Janc <ext.szymon.janc@tieto.com>2016-09-30 14:42:20 +0200
committerJohan Hedberg <johan.hedberg@intel.com>2016-10-16 09:00:57 +0300
commit0856ef3511b3b5dbecc09bdd880b4dccca64b5be (patch)
treedae4025f917425b144e1945d7e93cb611ea26992 /net
parentcb24f7d53b057cde448ac4fc8e960ed7c9b3c94b (diff)
Bluetooth: L2CAP: Treat fixed channel as connected on incoming data
This allows to correctly handle race when remote is sending fixed channel data before response to Informatino Request was received. Change-Id: I62e0daa744e11503d31b27f25952ae4ae23d5934 Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
Diffstat (limited to 'net')
-rw-r--r--net/bluetooth/l2cap_br.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/net/bluetooth/l2cap_br.c b/net/bluetooth/l2cap_br.c
index cb98dfd59..f8ef2932e 100644
--- a/net/bluetooth/l2cap_br.c
+++ b/net/bluetooth/l2cap_br.c
@@ -1606,6 +1606,15 @@ void l2cap_br_encrypt_change(struct bt_conn *conn, uint8_t hci_status)
}
}
+static void check_fixed_channel(struct bt_l2cap_chan *chan)
+{
+ struct bt_l2cap_br_chan *br_chan = BR_CHAN(chan);
+
+ if (br_chan->rx.cid < L2CAP_BR_DYN_CID_START) {
+ connect_fixed_channel(br_chan);
+ }
+}
+
void bt_l2cap_br_recv(struct bt_conn *conn, struct net_buf *buf)
{
struct bt_l2cap_hdr *hdr = (void *)buf->data;
@@ -1628,6 +1637,12 @@ void bt_l2cap_br_recv(struct bt_conn *conn, struct net_buf *buf)
return;
}
+ /*
+ * if data was received for fixed channel before Information
+ * Response we connect channel here.
+ */
+ check_fixed_channel(chan);
+
chan->ops->recv(chan, buf);
net_buf_unref(buf);
}