Skip to content

Commit

Permalink
Bluetooth: Controller: Disallow invalid connection interval value
Browse files Browse the repository at this point in the history
Disallow invalid connection interval value use in connection
establishment.

Signed-off-by: Vinayak Kariappa Chettimada <[email protected]>
  • Loading branch information
cvinayak committed Jan 22, 2025
1 parent 65b4f76 commit 124104e
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
7 changes: 7 additions & 0 deletions subsys/bluetooth/controller/ll_sw/ull_central.c
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,13 @@ uint8_t ll_create_connection(uint16_t scan_interval, uint16_t scan_window,
uint8_t hop;
int err;

/* Disallow invalid connection interval */
if (!IS_ENABLED(CONFIG_BT_CTLR_CONN_INTERVAL_LOW_LATENCY) &&
!IN_RANGE(interval, BT_HCI_LE_INTERVAL_MIN, BT_HCI_LE_INTERVAL_MAX)) {
return BT_HCI_ERR_INVALID_PARAM;
}

/* Concurrent scanning and initiating not supported */
scan = ull_scan_is_disabled_get(SCAN_HANDLE_1M);
if (!scan) {
return BT_HCI_ERR_CMD_DISALLOWED;
Expand Down
7 changes: 6 additions & 1 deletion subsys/bluetooth/controller/ll_sw/ull_peripheral.c
Original file line number Diff line number Diff line change
Expand Up @@ -157,10 +157,15 @@ void ull_periph_setup(struct node_rx_pdu *rx, struct node_rx_ftr *ftr,
sizeof(lll->data_chan_map));
lll->data_chan_hop = pdu_adv->connect_ind.hop;
lll->interval = sys_le16_to_cpu(pdu_adv->connect_ind.interval);

/* Check for minimum required channels, hop count and disallow invalid
* connection interval value.
*/
if ((lll->data_chan_count < CHM_USED_COUNT_MIN) ||
(lll->data_chan_hop < CHM_HOP_COUNT_MIN) ||
(lll->data_chan_hop > CHM_HOP_COUNT_MAX) ||
!lll->interval) {
(!IS_ENABLED(CONFIG_BT_CTLR_CONN_INTERVAL_LOW_LATENCY) &&
!IN_RANGE(lll->interval, BT_HCI_LE_INTERVAL_MIN, BT_HCI_LE_INTERVAL_MAX)) {
invalid_release(&adv->ull, lll, link, rx);

return;
Expand Down

0 comments on commit 124104e

Please sign in to comment.