Skip to content

bluetooth: host: Fix premature semaphore giving #89236

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 1, 2025

Conversation

fredrikdanebjer
Copy link
Collaborator

There was a semaphore in hci_core which was given to early when receiving the BT_HCI_EVT_NUM_COMPLETED_PACKETS message from the controller.

@jhedberg
Copy link
Member

Could you describe in a bit more detail (in the commit message) what the consequences of the premature semaphore giving has, i.e. what exactly did you observe? Also, please avoid such generic commit message titles and use something like "Bluetooth: Host: Fix premature semaphore giving".

There was a semaphore in hci_core which was given to early when
receiving the BT_HCI_EVT_NUM_COMPLETED_PACKETS message from the
controller. This would sometimes cause an assert to happen in
function hci_num_completed_packets, where there would arise a
mismatch in the bookkept count, and actually stored nodes. More
concretely, due to premature semaphore giveing, the tx_pending node
would be have been removed in another context before it could be
fetched and moved to complete list in this function.

Signed-off-by: Fredrik Danebjer <frdn@demant.com>
@fredrikdanebjer
Copy link
Collaborator Author

Could you describe in a bit more detail (in the commit message) what the consequences of the premature semaphore giving has, i.e. what exactly did you observe? Also, please avoid such generic commit message titles and use something like "Bluetooth: Host: Fix premature semaphore giving".

Ofc @jhedberg , will do

@fredrikdanebjer fredrikdanebjer marked this pull request as ready for review April 29, 2025 07:11
@jhedberg jhedberg changed the title bluetooth: hci: Fix bug in hci_core bluetooth: host: Fix premature semaphore giving Apr 29, 2025
@kartben kartben merged commit 379eb7a into zephyrproject-rtos:main May 1, 2025
31 checks passed
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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants