Skip to content

idc: zephyr_idc: check target core before taking idc_mutex#10889

Open
tmleman wants to merge 1 commit into
thesofproject:mainfrom
tmleman:topic/upstream/pr/zephyr/idc/fix_mutex_lock
Open

idc: zephyr_idc: check target core before taking idc_mutex#10889
tmleman wants to merge 1 commit into
thesofproject:mainfrom
tmleman:topic/upstream/pr/zephyr/idc/fix_mutex_lock

Conversation

@tmleman

@tmleman tmleman commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

idc_send_msg() acquired idc_mutex and then returned -EACCES on the disabled-core path without unlocking, leaking the mutex and blocking all later cross-core IDC sends.

Move the cpu_is_core_enabled() check ahead of the lock so the early return no longer holds the mutex and the per-core work slot is not touched for a disabled core.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Fixes a mutex leak in the Zephyr IDC implementation: idc_send_msg() could previously lock idc_mutex and then return -EACCES on the disabled-core path without unlocking, blocking subsequent cross-core sends.

Changes:

  • Move the cpu_is_core_enabled(target_cpu) check ahead of k_mutex_lock() to avoid returning while holding idc_mutex.

Comment thread src/idc/zephyr_idc.c Outdated
@tmleman tmleman force-pushed the topic/upstream/pr/zephyr/idc/fix_mutex_lock branch 2 times, most recently from bd635c6 to 45e1158 Compare June 12, 2026 11:54
idc_send_msg() acquired idc_mutex and then returned -EACCES on the
disabled-core path without unlocking, leaking the mutex and blocking
all later cross-core IDC sends.

Move the cpu_is_core_enabled() check ahead of the lock so the early
return no longer holds the mutex and the per-core work slot is not
touched for a disabled core.

Signed-off-by: Tomasz Leman <tomasz.m.leman@intel.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants