* [PATCH] ASoC: Intel: avs: Fix d0ix reference count leak on set_params error path
@ 2026-06-12 3:22 WenTao Liang
2026-06-18 15:55 ` Cezary Rojewski
0 siblings, 1 reply; 2+ messages in thread
From: WenTao Liang @ 2026-06-12 3:22 UTC (permalink / raw)
To: cezary.rojewski, liam.r.girdwood, peter.ujfalusi,
yung-chuan.liao, kai.vehmanen, broonie, perex, tiwai
Cc: pierre-louis.bossart, amadeuszx.slawinski, songxiebing,
verhaegen, vulab, linux-sound, linux-kernel, stable
In avs_probe_compr_set_params(), avs_dsp_disable_d0ix() is called when
no probe streams are active. This function atomically increments the
d0ix_disable_depth counter before attempting the hardware power state
transition. If the transition (avs_dsp_set_d0ix()) fails, the function
returns an error but the counter remains elevated.
The caller does not balance the counter on this error path, causing a
reference count leak that permanently prevents the DSP from entering
d0ix.
Fix the leak by calling avs_dsp_enable_d0ix() to balance the previous
disable call before returning the error, mirroring the existing cleanup
pattern used when avs_dsp_init_probe() fails.
Cc: stable@vger.kernel.org
Fixes: 700462f55493 ("ASoC: Intel: avs: Probe compress operations")
Signed-off-by: WenTao Liang <vulab@iscas.ac.cn>
---
sound/soc/intel/avs/probes.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/sound/soc/intel/avs/probes.c b/sound/soc/intel/avs/probes.c
index 099119ad28b3..01d9421cf9ab 100644
--- a/sound/soc/intel/avs/probes.c
+++ b/sound/soc/intel/avs/probes.c
@@ -162,8 +162,10 @@ static int avs_probe_compr_set_params(struct snd_compr_stream *cstream,
/* D0ix not allowed during probing. */
ret = avs_dsp_disable_d0ix(adev);
- if (ret)
+ if (ret) {
+ avs_dsp_enable_d0ix(adev);
return ret;
+ }
node_id.vindex = hdac_stream(host_stream)->stream_tag - 1;
node_id.dma_type = AVS_DMA_HDA_HOST_INPUT;
--
2.50.1 (Apple Git-155)
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: [PATCH] ASoC: Intel: avs: Fix d0ix reference count leak on set_params error path
2026-06-12 3:22 [PATCH] ASoC: Intel: avs: Fix d0ix reference count leak on set_params error path WenTao Liang
@ 2026-06-18 15:55 ` Cezary Rojewski
0 siblings, 0 replies; 2+ messages in thread
From: Cezary Rojewski @ 2026-06-18 15:55 UTC (permalink / raw)
To: WenTao Liang
Cc: pierre-louis.bossart, amadeuszx.slawinski, songxiebing,
verhaegen, linux-sound, linux-kernel, stable, liam.r.girdwood,
peter.ujfalusi, yung-chuan.liao, kai.vehmanen, broonie, perex,
tiwai
On 6/12/2026 5:22 AM, WenTao Liang wrote:
> In avs_probe_compr_set_params(), avs_dsp_disable_d0ix() is called when
> no probe streams are active. This function atomically increments the
> d0ix_disable_depth counter before attempting the hardware power state
> transition. If the transition (avs_dsp_set_d0ix()) fails, the function
> returns an error but the counter remains elevated.
>
> The caller does not balance the counter on this error path, causing a
> reference count leak that permanently prevents the DSP from entering
> d0ix.
>
> Fix the leak by calling avs_dsp_enable_d0ix() to balance the previous
> disable call before returning the error, mirroring the existing cleanup
> pattern used when avs_dsp_init_probe() fails.
Hi,
When using AI assistance to generate a commit message the strict kernel
rules still apply. Please plainly answer _why_ the change is made, no
need to write a novel. The last last two paragraphs could be simply
dropped.
See Documentation/process for a number of helpful guides both for
writing doc manually and with assistance.
> Cc: stable@vger.kernel.org
> Fixes: 700462f55493 ("ASoC: Intel: avs: Probe compress operations")
> Signed-off-by: WenTao Liang <vulab@iscas.ac.cn>
> ---
> sound/soc/intel/avs/probes.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/sound/soc/intel/avs/probes.c b/sound/soc/intel/avs/probes.c
> index 099119ad28b3..01d9421cf9ab 100644
> --- a/sound/soc/intel/avs/probes.c
> +++ b/sound/soc/intel/avs/probes.c
> @@ -162,8 +162,10 @@ static int avs_probe_compr_set_params(struct snd_compr_stream *cstream,
>
> /* D0ix not allowed during probing. */
> ret = avs_dsp_disable_d0ix(adev);
> - if (ret)
> + if (ret) {
> + avs_dsp_enable_d0ix(adev);
Things are not that simple with D0IX - D0-substates. In short, if
SET_D0IX IPC-message fails, the recommendation is to forgo the process
entirely, see comments in avs_dsp_set_d0ix() and avs_dsp_get_core().
Blind enable - no.
I could see avs_dsp_disable_d0ix() receiving an update that takes care
of lowering ->d0ix_disable_depth in case of non-IPC failure, if you're
willing to follow up.
> return ret;
> + }
>
> node_id.vindex = hdac_stream(host_stream)->stream_tag - 1;
> node_id.dma_type = AVS_DMA_HDA_HOST_INPUT;
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-06-18 15:55 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-06-12 3:22 [PATCH] ASoC: Intel: avs: Fix d0ix reference count leak on set_params error path WenTao Liang
2026-06-18 15:55 ` Cezary Rojewski
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®