Skip to content

ASoC: SOF: sof-client: Use event-handler mutex consistently#5803

Open
ujfalusi wants to merge 1 commit into
thesofproject:topic/sof-devfrom
ujfalusi:peter/sof/pr/sof-client-wrong-lock-notif
Open

ASoC: SOF: sof-client: Use event-handler mutex consistently#5803
ujfalusi wants to merge 1 commit into
thesofproject:topic/sof-devfrom
ujfalusi:peter/sof/pr/sof-client-wrong-lock-notif

Conversation

@ujfalusi
Copy link
Copy Markdown
Collaborator

@ujfalusi ujfalusi commented Jun 8, 2026

Protect IPC RX and FW state handler list unregister/dispatch paths with client_event_handler_mutex to match list registration and locking comments.

Fixes: 5c19da3 ("ASoC: SOF: Use guard()/scoped_guard() for mutex locks where it makes sense")

Protect IPC RX and FW state handler list unregister/dispatch paths with
client_event_handler_mutex to match list registration and locking
comments.

Fixes: 5c19da3 ("ASoC: SOF: Use guard()/scoped_guard() for mutex locks where it makes sense")
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Copilot AI review requested due to automatic review settings June 8, 2026 14:11
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR aligns locking for SOF client event handler lists by using client_event_handler_mutex consistently across register/unregister and dispatch paths, matching the intent documented for protecting the handler lists.

Changes:

  • Switch IPC RX handler unregistration to use client_event_handler_mutex.
  • Switch FW state handler dispatch and unregistration to use client_event_handler_mutex.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 612 to 616
struct snd_sof_dev *sdev = sof_client_dev_to_sof_dev(cdev);
struct sof_ipc_event_entry *event;

guard(mutex)(&sdev->ipc_client_mutex);
guard(mutex)(&sdev->client_event_handler_mutex);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@ujfalusi seems valid. Fwiw not sure if this matters today, but this also made me think about the pcm and kcontrol using different locks since they are async, eventually a sof client could hold either pcm/kcontrol lock.

Comment on lines +632 to 635
guard(mutex)(&sdev->client_event_handler_mutex);

list_for_each_entry(event, &sdev->fw_state_handler_list, list)
event->callback(event->cdev, sdev->fw_state);
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.

3 participants