aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohan Hedberg <johan.hedberg@intel.com>2014-01-25 17:10:09 -0500
committerJohan Hedberg <johan.hedberg@intel.com>2014-02-13 02:51:37 -0500
commit7a8e5a31ecd50ace4fce57304c8fdd206f013fde (patch)
tree67ed961eef036b7ba6ad6a9bec7957ae70e7a49d
parente0c888ad739513b9baae5c25e85dd6490595e5be (diff)
Bluetooth: Fix CID initialization for fixed channels
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>
-rw-r--r--net/bluetooth/l2cap_core.c2
-rw-r--r--net/bluetooth/l2cap_sock.c5
2 files changed, 5 insertions, 2 deletions
diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c
index e5c5c7427c41..cc340700573e 100644
--- a/net/bluetooth/l2cap_core.c
+++ b/net/bluetooth/l2cap_core.c
@@ -1462,8 +1462,6 @@ static void l2cap_le_conn_ready(struct l2cap_conn *conn)
1462 if (!chan) 1462 if (!chan)
1463 goto clean; 1463 goto clean;
1464 1464
1465 chan->dcid = L2CAP_CID_ATT;
1466
1467 bacpy(&chan->src, &hcon->src); 1465 bacpy(&chan->src, &hcon->src);
1468 bacpy(&chan->dst, &hcon->dst); 1466 bacpy(&chan->dst, &hcon->dst);
1469 chan->src_type = bdaddr_type(hcon, hcon->src_type); 1467 chan->src_type = bdaddr_type(hcon, hcon->src_type);
diff --git a/net/bluetooth/l2cap_sock.c b/net/bluetooth/l2cap_sock.c
index 7ad346ea06ed..ae4f6b593fc0 100644
--- a/net/bluetooth/l2cap_sock.c
+++ b/net/bluetooth/l2cap_sock.c
@@ -1470,6 +1470,11 @@ static void l2cap_sock_init(struct sock *sk, struct sock *parent)
1470 chan->tx_credits = pchan->tx_credits; 1470 chan->tx_credits = pchan->tx_credits;
1471 chan->rx_credits = pchan->rx_credits; 1471 chan->rx_credits = pchan->rx_credits;
1472 1472
1473 if (chan->chan_type == L2CAP_CHAN_FIXED) {
1474 chan->scid = pchan->scid;
1475 chan->dcid = pchan->scid;
1476 }
1477
1473 security_sk_clone(parent, sk); 1478 security_sk_clone(parent, sk);
1474 } else { 1479 } else {
1475 switch (sk->sk_type) { 1480 switch (sk->sk_type) {