Skip to content
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

bluetooth: host: fix hang issue caused by 2 consecutive bt disable co… #87611

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

zhaynxp
Copy link
Contributor

@zhaynxp zhaynxp commented Mar 25, 2025

the bt_dev.flags will be reset to BT_DEV_ENABLE in hci_reset_complete() API which among bt_disable() API, it will clear the previously set BT_DEV_DISABLE flag in the begining of bt_disable() API, and resulting 2nd bt_disable go ahead to execute without BT_DEV_DISABLE flag protection, finally device hang at failed to receive HCI_Reset event in 2nd bt_disable() due to hci->recv was cleared at 1st time bt_disable() called.

@zephyrbot zephyrbot added size: XS A PR changing only a single line of code area: Bluetooth area: Bluetooth Host Bluetooth Host (excluding BR/EDR) labels Mar 25, 2025
@zhaynxp zhaynxp force-pushed the fix_2_btdisable_hang branch 2 times, most recently from 2bf46ee to 6d57c33 Compare March 25, 2025 11:36
…ands

- add BT_DEV_DISABLE flag to BT_DEV_PERSISTENT_FLAGS to
  protect consecutive bt disable from running

Signed-off-by: Ying Zhang <ying.zhang_2@nxp.com>
@zhaynxp zhaynxp force-pushed the fix_2_btdisable_hang branch from 6d57c33 to 88fd228 Compare March 25, 2025 11:39
Copy link
Collaborator

@Thalley Thalley left a comment

Choose a reason for hiding this comment

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

I think this looks good.

This way bt_disable can not be called twice without a bt_enable in-between, which I think is correct behavior.

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 size: XS A PR changing only a single line of code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants