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

wifi: esp_at: claim net_context in rx #43522

Merged
merged 1 commit into from
Mar 15, 2022
Merged

wifi: esp_at: claim net_context in rx #43522

merged 1 commit into from
Mar 15, 2022

Conversation

JordanYates
Copy link
Collaborator

Claim the net_context mutext associated with a socket before claiming
the socket mutex. The receive callback claims the net_context mutex
internally, which will now always succeed immediately.

The TX path claims the net_context mutex before the socket mutex, and if
we don't use the same order, we can end up in a deadlock.

Fixes #43470.

I'm not convinced this is the best solution, but it does fix the deadlock potential without a larger code refactor.

Claim the net_context mutext associated with a socket before claiming
the socket mutex. The receive callback claims the net_context mutex
internally, which will now always succeed immediately.

The TX path claims the net_context mutex before the socket mutex, and if
we don't use the same order, we can end up in a deadlock.

Fixes #43470.

Signed-off-by: Jordan Yates <[email protected]>
@carlescufi carlescufi merged commit ad959bc into zephyrproject-rtos:main Mar 15, 2022
@ycsin ycsin added the backport v2.7-branch Request backport to the v2.7-branch label Mar 21, 2022
@JordanYates JordanYates deleted the 220308_esp_rx_deadlock branch August 15, 2022 11:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: Networking area: Wi-Fi Wi-Fi backport v2.7-branch Request backport to the v2.7-branch
Projects
None yet
Development

Successfully merging this pull request may close these issues.

wifi: esp_at: race condition on mutex's leading to deadlock
7 participants