Fix return without unlocking thd_engine_mutex#528
Merged
spandruvada merged 1 commit intointel:masterfrom Mar 3, 2026
Merged
Conversation
A recent set of checks on path don't unlock thd_engine_mutex on error return exits from cthd_engine::user_add_senso leading to locking issues. Fix this by performing the lock on thd_engine_mutex after the sanity checks on path to avoid the locking issue and to defer locking to the latest point where it is required. Fixes: d74be68 ("Check for start path instead of anywhere") Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
gaul
reviewed
Feb 28, 2026
|
|
||
| if (path.empty()) | ||
| return THD_ERROR; | ||
| pthread_mutex_unlock(&thd_engine_mutex); |
Contributor
There was a problem hiding this comment.
Why do you need to unlock here?
Contributor
There was a problem hiding this comment.
It was locked before as it is running on a dfferent thread than the thermald controls
Contributor
There was a problem hiding this comment.
Could you expand on the intended locking of cthd_engine::user_add_sensor? I understand that sensors is protected by thd_engine_mutex. Tracing the call stack, thd_dbus_interface_add_sensor calls user_add_sensor yet I don't see this or the DBUS-related methods holding the lock. Is the lock intended to be held before calling this function? Also is it correct to just unlock without returning?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A recent set of checks on path don't unlock thd_engine_mutex on error return exits from cthd_engine::user_add_senso leading to locking issues.
Fix this by performing the lock on thd_engine_mutex after the sanity checks on path to avoid the locking issue and to defer locking to the latest point where it is required.
Fixes: d74be68 ("Check for start path instead of anywhere")