* [PATCH] firmware: cs_dsp: fix missing pwr_lock in cs_dsp_signal_event_controls()
@ 2026-01-31 22:33 Ziyi Guo
2026-02-02 9:58 ` Richard Fitzgerald
0 siblings, 1 reply; 3+ messages in thread
From: Ziyi Guo @ 2026-01-31 22:33 UTC (permalink / raw)
To: Simon Trimmer, Charles Keepax, Richard Fitzgerald
Cc: patches, linux-kernel, Ziyi Guo
cs_dsp_signal_event_controls() calls cs_dsp_coeff_write_acked_control()
which has lockdep_assert_held(&dsp->pwr_lock), but the lock is not held.
Add mutex_lock()/mutex_unlock() around the control list iteration in
cs_dsp_signal_event_controls() to fix the missing lock protection.
Signed-off-by: Ziyi Guo <n7l8m4@u.northwestern.edu>
---
drivers/firmware/cirrus/cs_dsp.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/firmware/cirrus/cs_dsp.c b/drivers/firmware/cirrus/cs_dsp.c
index 525ac0f0a75d..0067cf292c62 100644
--- a/drivers/firmware/cirrus/cs_dsp.c
+++ b/drivers/firmware/cirrus/cs_dsp.c
@@ -972,6 +972,8 @@ static void cs_dsp_signal_event_controls(struct cs_dsp *dsp,
struct cs_dsp_coeff_ctl *ctl;
int ret;
+ mutex_lock(&dsp->pwr_lock);
+
list_for_each_entry(ctl, &dsp->ctl_list, list) {
if (ctl->type != WMFW_CTL_TYPE_HOSTEVENT)
continue;
@@ -985,6 +987,8 @@ static void cs_dsp_signal_event_controls(struct cs_dsp *dsp,
"Failed to send 0x%x event to alg 0x%x (%d)\n",
event, ctl->alg_region.alg, ret);
}
+
+ mutex_unlock(&dsp->pwr_lock);
}
static void cs_dsp_free_ctl_blk(struct cs_dsp_coeff_ctl *ctl)
--
2.34.1
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] firmware: cs_dsp: fix missing pwr_lock in cs_dsp_signal_event_controls()
2026-01-31 22:33 [PATCH] firmware: cs_dsp: fix missing pwr_lock in cs_dsp_signal_event_controls() Ziyi Guo
@ 2026-02-02 9:58 ` Richard Fitzgerald
2026-02-02 14:06 ` Ziyi Guo
0 siblings, 1 reply; 3+ messages in thread
From: Richard Fitzgerald @ 2026-02-02 9:58 UTC (permalink / raw)
To: Ziyi Guo, Simon Trimmer, Charles Keepax; +Cc: patches, linux-kernel
On 31/01/2026 10:33 pm, Ziyi Guo wrote:
> cs_dsp_signal_event_controls() calls cs_dsp_coeff_write_acked_control()
> which has lockdep_assert_held(&dsp->pwr_lock), but the lock is not held.
>
> Add mutex_lock()/mutex_unlock() around the control list iteration in
> cs_dsp_signal_event_controls() to fix the missing lock protection.
>
> Signed-off-by: Ziyi Guo <n7l8m4@u.northwestern.edu>
I don't think this is the correct fix.
The mutex_lock() in cs_dsp_stop() should be at the top of the function.
Compare with cs_dsp_run().
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] firmware: cs_dsp: fix missing pwr_lock in cs_dsp_signal_event_controls()
2026-02-02 9:58 ` Richard Fitzgerald
@ 2026-02-02 14:06 ` Ziyi Guo
0 siblings, 0 replies; 3+ messages in thread
From: Ziyi Guo @ 2026-02-02 14:06 UTC (permalink / raw)
To: Richard Fitzgerald; +Cc: Simon Trimmer, Charles Keepax, patches, linux-kernel
On Mon, Feb 2, 2026 at 4:58 AM Richard Fitzgerald
<rf@opensource.cirrus.com> wrote:
> I don't think this is the correct fix.
>
> The mutex_lock() in cs_dsp_stop() should be at the top of the function.
> Compare with cs_dsp_run().
Thanks for your time and review, I'll send a v2 version patch, let the
mutex_lock() be at the top of the function cs_dsp_stop().
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-02-02 14:06 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-01-31 22:33 [PATCH] firmware: cs_dsp: fix missing pwr_lock in cs_dsp_signal_event_controls() Ziyi Guo
2026-02-02 9:58 ` Richard Fitzgerald
2026-02-02 14:06 ` Ziyi Guo
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®