bt/ble_log: release fallback mutex on host write errors (IDFGH-17872)#18770
Open
Old-Ding wants to merge 1 commit into
Open
bt/ble_log: release fallback mutex on host write errors (IDFGH-17872)#18770Old-Ding wants to merge 1 commit into
Old-Ding wants to merge 1 commit into
Conversation
8250f96 to
e349ca3
Compare
Author
|
Maintainer ping: CLA and the current checks are passing, the branch is mergeable, and this is still at |
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.
Summary
This fixes the fallback path in
ble_log_spi_out_host_write()so thatLOG_MODULE_MUTEX(ul)is released on host write errors.When no host task mapping is available, the function falls back to the
ullog buffer and takesLOG_MODULE_MUTEX(ul). Two error paths after that point returned-1directly, leaving the fallback mutex locked.Changes
ble_log_spi_out_host_write()after fallback lock ownership can exist.Testing
git diff --check origin/master..HEADrg -n "ble_log_spi_out_host_write|fallback|LOG_MODULE_MUTEX\\(ul\\)|return -1|goto exit|ret =" components/bt/common/ble_log/deprecated/ble_log_spi_out.cgit diff --stat origin/master..HEADBuild not run locally:
idf.pyis not available in this Windows environment.Note
Low Risk
Small, localized fix in deprecated BLE log SPI code; behavior on success is unchanged and only error cleanup is corrected.
Overview
Fixes a mutex leak in deprecated
ble_log_spi_out_host_write()when the NimBLE fallback path is used (no host task mapping → takesLOG_MODULE_MUTEX(ul)and uses theullog buffer).Previously, oversized prefix and failed string formatting (
total_len == 0) returned-1immediately and never calledxSemaphoreGive, which could deadlock other BLE log SPI output onul.The change routes those failures through a shared
exitlabel, setsretto0only on success, and always releases the fallback mutex before returning.Reviewed by Cursor Bugbot for commit e349ca3. Bugbot is set up for automated code reviews on this repo. Configure here.