Skip to content

Commit c18cb0c

Browse files
committed
Bluetooth: Host: l2cap: Fix MPS/MTU confusion
The implementation used BT_L2CAP_ECRED_MIN_MTU to check the lower limits of both MTU and MPS, instead of BT_L2CAP_ECRED_MIN_MPS for MPS. While these are the same here, confusion may arise. This commit fixes the confusion. Signed-off-by: Håvard Reierstad <[email protected]>
1 parent 322da1d commit c18cb0c

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

subsys/bluetooth/host/l2cap.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1474,6 +1474,7 @@ static void le_conn_req(struct bt_l2cap *l2cap, uint8_t ident,
14741474

14751475
LOG_DBG("psm 0x%02x scid 0x%04x mtu %u mps %u credits %u", psm, scid, mtu, mps, credits);
14761476

1477+
/* The minimum MTU and MPS are the same for LE */
14771478
if (mtu < L2CAP_LE_MIN_MTU || mps < L2CAP_LE_MIN_MTU) {
14781479
LOG_ERR("Invalid LE-Conn Req params: mtu %u mps %u", mtu, mps);
14791480
return;
@@ -1573,7 +1574,7 @@ static void le_ecred_conn_req(struct bt_l2cap *l2cap, uint8_t ident,
15731574

15741575
LOG_DBG("psm 0x%02x mtu %u mps %u credits %u", psm, mtu, mps, credits);
15751576

1576-
if (mtu < BT_L2CAP_ECRED_MIN_MTU || mps < BT_L2CAP_ECRED_MIN_MTU) {
1577+
if (mtu < BT_L2CAP_ECRED_MIN_MTU || mps < BT_L2CAP_ECRED_MIN_MPS) {
15771578
LOG_ERR("Invalid ecred conn req params. mtu %u mps %u", mtu, mps);
15781579
result = BT_L2CAP_LE_ERR_INVALID_PARAMS;
15791580
goto response;
@@ -1681,7 +1682,7 @@ static void le_ecred_reconf_req(struct bt_l2cap *l2cap, uint8_t ident,
16811682
mtu = sys_le16_to_cpu(req->mtu);
16821683
mps = sys_le16_to_cpu(req->mps);
16831684

1684-
if (mps < BT_L2CAP_ECRED_MIN_MTU) {
1685+
if (mps < BT_L2CAP_ECRED_MIN_MPS) {
16851686
result = BT_L2CAP_RECONF_OTHER_UNACCEPT;
16861687
goto response;
16871688
}

0 commit comments

Comments
 (0)