Skip to content

Conversation

@JordanYates
Copy link
Contributor

@JordanYates JordanYates commented Feb 6, 2025

Add check that the command buffer claimed in bt_le_create_conn_cancel is not NULL. Fixes a fault caused by providing the NULL buffer to bt_hci_cmd_state_set_init.

Primary fix from #85260.
Increasing the command buffer count as discussed in Bluetooth WG 2025/02/06
Once the changes are validated here, a duplicate PR to the v4.0 branch will be created.

Fixes #85301

Add check that the command buffer claimed in `bt_le_create_conn_cancel`
is not `NULL`. Fixes a fault caused by providing the `NULL` buffer to
`bt_hci_cmd_state_set_init`.

Signed-off-by: Jordan Yates <[email protected]>
The extended advertising start procedure can consume both command
buffers in a single API call, resulting in `bt_le_create_conn_cancel`
being unable to claim a buffer to terminate the connection request.

Increase the command count if both extended advertising and Bluetooth
central are enabled in an application.

Signed-off-by: Jordan Yates <[email protected]>

config BT_BUF_CMD_TX_COUNT
int "Number of HCI command buffers"
default 3 if BT_EXT_ADV && BT_CENTRAL
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just leaving a comment here that le_ext_adv_param_set uses 2 HCI Command Buffers in a nested format, starving the connection create cancel when invoked from system work queue to fail silently (This can happen if a pre-emptive thread is starting advertising).

The nested use of HCI Command Buffers will be fixed in b21c386

@fabiobaltieri fabiobaltieri added the Trivial Changes that can be reviewed by anyone, i.e. doc changes, minor build system tweaks, etc. label Feb 13, 2025
@jhedberg jhedberg changed the title bluetooth: host: hci_core: add missing NULL check [backport v3.7-branch] bluetooth: host: hci_core: add missing NULL check Feb 13, 2025
@JarmouniA JarmouniA added this to the v3.7.2 milestone Feb 14, 2025
@nashif nashif merged commit 0e5cda3 into zephyrproject-rtos:v3.7-branch Feb 21, 2025
34 checks passed
@JordanYates JordanYates deleted the 250206_37_conn_timeout branch February 21, 2025 01:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: Bluetooth Host Bluetooth Host (excluding BR/EDR) area: Bluetooth Trivial Changes that can be reviewed by anyone, i.e. doc changes, minor build system tweaks, etc.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants