Skip to content

Commit 18c2ed6

Browse files
Vudentzvijay-suman
authored andcommitted
Bluetooth: L2CAP: Fix rejecting L2CAP_CONN_PARAM_UPDATE_REQ
[ Upstream commit 806a519 ] This removes the bogus check for max > hcon->le_conn_max_interval since the later is just the initial maximum conn interval not the maximum the stack could support which is really 3200=4000ms. In order to pass GAP/CONN/CPUP/BV-05-C one shall probably enter values of the following fields in IXIT that would cause hci_check_conn_params to fail: TSPX_conn_update_int_min TSPX_conn_update_int_max TSPX_conn_update_peripheral_latency TSPX_conn_update_supervision_timeout Link: bluez/bluez#847 Fixes: e4b0195 ("Bluetooth: Enforce validation on max value of connection interval") Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com> Signed-off-by: Sasha Levin <sashal@kernel.org> (cherry picked from commit 3c2a6dd631062904e3d9b1954656676356f617a4) FOF: 0824 Signed-off-by: Vijayendra Suman <vijayendra.suman@oracle.com>
1 parent becd16b commit 18c2ed6

File tree

2 files changed

+33
-11
lines changed

2 files changed

+33
-11
lines changed

include/net/bluetooth/hci_core.h

Lines changed: 32 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1690,18 +1690,46 @@ static inline int hci_check_conn_params(u16 min, u16 max, u16 latency,
16901690
{
16911691
u16 max_latency;
16921692

1693-
if (min > max || min < 6 || max > 3200)
1693+
if (min > max) {
1694+
BT_WARN("min %d > max %d", min, max);
16941695
return -EINVAL;
1696+
}
1697+
1698+
if (min < 6) {
1699+
BT_WARN("min %d < 6", min);
1700+
return -EINVAL;
1701+
}
1702+
1703+
if (max > 3200) {
1704+
BT_WARN("max %d > 3200", max);
1705+
return -EINVAL;
1706+
}
1707+
1708+
if (to_multiplier < 10) {
1709+
BT_WARN("to_multiplier %d < 10", to_multiplier);
1710+
return -EINVAL;
1711+
}
16951712

1696-
if (to_multiplier < 10 || to_multiplier > 3200)
1713+
if (to_multiplier > 3200) {
1714+
BT_WARN("to_multiplier %d > 3200", to_multiplier);
16971715
return -EINVAL;
1716+
}
16981717

1699-
if (max >= to_multiplier * 8)
1718+
if (max >= to_multiplier * 8) {
1719+
BT_WARN("max %d >= to_multiplier %d * 8", max, to_multiplier);
17001720
return -EINVAL;
1721+
}
17011722

17021723
max_latency = (to_multiplier * 4 / max) - 1;
1703-
if (latency > 499 || latency > max_latency)
1724+
if (latency > 499) {
1725+
BT_WARN("latency %d > 499", latency);
17041726
return -EINVAL;
1727+
}
1728+
1729+
if (latency > max_latency) {
1730+
BT_WARN("latency %d > max_latency %d", latency, max_latency);
1731+
return -EINVAL;
1732+
}
17051733

17061734
return 0;
17071735
}

net/bluetooth/l2cap_core.c

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5617,13 +5617,7 @@ static inline int l2cap_conn_param_update_req(struct l2cap_conn *conn,
56175617

56185618
memset(&rsp, 0, sizeof(rsp));
56195619

5620-
if (max > hcon->le_conn_max_interval) {
5621-
BT_DBG("requested connection interval exceeds current bounds.");
5622-
err = -EINVAL;
5623-
} else {
5624-
err = hci_check_conn_params(min, max, latency, to_multiplier);
5625-
}
5626-
5620+
err = hci_check_conn_params(min, max, latency, to_multiplier);
56275621
if (err)
56285622
rsp.result = cpu_to_le16(L2CAP_CONN_PARAM_REJECTED);
56295623
else

0 commit comments

Comments
 (0)