aboutsummaryrefslogtreecommitdiffstats
path: root/net/bluetooth/l2cap_core.c
diff options
context:
space:
mode:
authorJohan Hedberg <johan.hedberg@intel.com>2014-01-24 03:35:41 -0500
committerJohan Hedberg <johan.hedberg@intel.com>2014-02-13 02:51:37 -0500
commit21626e6214f92aaae580052c760dc85f83b5faef (patch)
tree425df2304948783f3794331c313b7086d9933344 /net/bluetooth/l2cap_core.c
parent2338a7e0440d646c194d421748ea36665e648384 (diff)
Bluetooth: Switch ATT channels to use L2CAP_CHAN_FIXED
ATT channels are not connection oriented so having them use L2CAP_CHAN_CONN_ORIENTED is quite confusing. Instead, use the new L2CAP_CHAN_FIXED type and ensure that the MTU and CID values get properly set. 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.c21
1 files changed, 9 insertions, 12 deletions
diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c
index cd28057d2903..e5c5c7427c41 100644
--- a/net/bluetooth/l2cap_core.c
+++ b/net/bluetooth/l2cap_core.c
@@ -498,18 +498,10 @@ void __l2cap_chan_add(struct l2cap_conn *conn, struct l2cap_chan *chan)
498 498
499 switch (chan->chan_type) { 499 switch (chan->chan_type) {
500 case L2CAP_CHAN_CONN_ORIENTED: 500 case L2CAP_CHAN_CONN_ORIENTED:
501 if (conn->hcon->type == LE_LINK) { 501 /* Alloc CID for connection-oriented socket */
502 if (chan->dcid == L2CAP_CID_ATT) { 502 chan->scid = l2cap_alloc_cid(conn);
503 chan->omtu = L2CAP_DEFAULT_MTU; 503 if (conn->hcon->type == ACL_LINK)
504 chan->scid = L2CAP_CID_ATT;
505 } else {
506 chan->scid = l2cap_alloc_cid(conn);
507 }
508 } else {
509 /* Alloc CID for connection-oriented socket */
510 chan->scid = l2cap_alloc_cid(conn);
511 chan->omtu = L2CAP_DEFAULT_MTU; 504 chan->omtu = L2CAP_DEFAULT_MTU;
512 }
513 break; 505 break;
514 506
515 case L2CAP_CHAN_CONN_LESS: 507 case L2CAP_CHAN_CONN_LESS:
@@ -7025,7 +7017,12 @@ int l2cap_chan_connect(struct l2cap_chan *chan, __le16 psm, u16 cid,
7025 goto done; 7017 goto done;
7026 } 7018 }
7027 7019
7028 if (chan->chan_type == L2CAP_CHAN_CONN_ORIENTED && !(psm || cid)) { 7020 if (chan->chan_type == L2CAP_CHAN_CONN_ORIENTED && !psm) {
7021 err = -EINVAL;
7022 goto done;
7023 }
7024
7025 if (chan->chan_type == L2CAP_CHAN_FIXED && !cid) {
7029 err = -EINVAL; 7026 err = -EINVAL;
7030 goto done; 7027 goto done;
7031 } 7028 }