Skip to content

Commit 01ec0ff

Browse files
HaavardReinordicjm
authored andcommitted
[nrf fromtree] 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]> (cherry picked from commit d989188) Signed-off-by: Håvard Reierstad <[email protected]>
1 parent 57d8ace commit 01ec0ff

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

subsys/bluetooth/host/l2cap.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ LOG_MODULE_REGISTER(bt_l2cap, CONFIG_BT_L2CAP_LOG_LEVEL);
4646
#define CHAN_RX(_w) CONTAINER_OF(_w, struct bt_l2cap_le_chan, rx_work)
4747

4848
#define L2CAP_LE_MIN_MTU 23
49+
#define L2CAP_LE_MIN_MPS 23
4950

5051
#define L2CAP_LE_MAX_CREDITS (BT_BUF_ACL_RX_COUNT - 1)
5152

@@ -1478,7 +1479,7 @@ static void le_conn_req(struct bt_l2cap *l2cap, uint8_t ident,
14781479

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

1481-
if (mtu < L2CAP_LE_MIN_MTU || mps < L2CAP_LE_MIN_MTU) {
1482+
if (mtu < L2CAP_LE_MIN_MTU || mps < L2CAP_LE_MIN_MPS) {
14821483
LOG_ERR("Invalid LE-Conn Req params: mtu %u mps %u", mtu, mps);
14831484
return;
14841485
}
@@ -1577,7 +1578,7 @@ static void le_ecred_conn_req(struct bt_l2cap *l2cap, uint8_t ident,
15771578

15781579
LOG_DBG("psm 0x%02x mtu %u mps %u credits %u", psm, mtu, mps, credits);
15791580

1580-
if (mtu < BT_L2CAP_ECRED_MIN_MTU || mps < BT_L2CAP_ECRED_MIN_MTU) {
1581+
if (mtu < BT_L2CAP_ECRED_MIN_MTU || mps < BT_L2CAP_ECRED_MIN_MPS) {
15811582
LOG_ERR("Invalid ecred conn req params. mtu %u mps %u", mtu, mps);
15821583
result = BT_L2CAP_LE_ERR_INVALID_PARAMS;
15831584
goto response;
@@ -1685,7 +1686,7 @@ static void le_ecred_reconf_req(struct bt_l2cap *l2cap, uint8_t ident,
16851686
mtu = sys_le16_to_cpu(req->mtu);
16861687
mps = sys_le16_to_cpu(req->mps);
16871688

1688-
if (mps < BT_L2CAP_ECRED_MIN_MTU) {
1689+
if (mps < BT_L2CAP_ECRED_MIN_MPS) {
16891690
result = BT_L2CAP_RECONF_OTHER_UNACCEPT;
16901691
goto response;
16911692
}

0 commit comments

Comments
 (0)