]> git.karo-electronics.de Git - linux-beck.git/commitdiff
Bluetooth: Fix CID initialization for fixed channels
authorJohan Hedberg <johan.hedberg@intel.com>
Sat, 25 Jan 2014 22:10:09 +0000 (17:10 -0500)
committerJohan Hedberg <johan.hedberg@intel.com>
Thu, 13 Feb 2014 07:51:37 +0000 (09:51 +0200)
Fixed channels have the same source and destination CID. Ensure that the
values get properly initialized when receiving incoming connections and
deriving values from the parent socket.

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

index e5c5c7427c410ed1754adbe6aa8a4209118746ff..cc340700573e0895acc25b6a04541601c27ad248 100644 (file)
@@ -1462,8 +1462,6 @@ static void l2cap_le_conn_ready(struct l2cap_conn *conn)
        if (!chan)
                goto clean;
 
-       chan->dcid = L2CAP_CID_ATT;
-
        bacpy(&chan->src, &hcon->src);
        bacpy(&chan->dst, &hcon->dst);
        chan->src_type = bdaddr_type(hcon, hcon->src_type);
index 7ad346ea06ed047cc4d0da1ca43c980eba43dcc3..ae4f6b593fc015def2ea684220daddfbd4050fb4 100644 (file)
@@ -1470,6 +1470,11 @@ static void l2cap_sock_init(struct sock *sk, struct sock *parent)
                chan->tx_credits = pchan->tx_credits;
                chan->rx_credits = pchan->rx_credits;
 
+               if (chan->chan_type == L2CAP_CHAN_FIXED) {
+                       chan->scid = pchan->scid;
+                       chan->dcid = pchan->scid;
+               }
+
                security_sk_clone(parent, sk);
        } else {
                switch (sk->sk_type) {