linux/sound/soc/qcom
Srinivas Kandagatla 985131a81e ASoC: qcom: sdw: fix memory leak for sdw_stream_runtime
[ Upstream commit bcba172793 ]

For some reason we endedup allocating sdw_stream_runtime for every cpu dai,
this has two issues.
1. we never set snd_soc_dai_set_stream for non soundwire dai, which
   means there is no way that we can free this, resulting in memory leak
2. startup and shutdown callbacks can be called without
   hw_params callback called. This combination results in memory leak
because machine driver sruntime array pointer is only set in hw_params
callback.

Fix this by
 1. adding a helper function to get sdw_runtime for substream
which can be used by shutdown callback to get hold of sruntime to free.
 2. only allocate sdw_runtime for soundwire dais.

Fixes: d32bac9cb0 ("ASoC: qcom: Add helper for allocating Soundwire stream runtime")
Cc: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Cc: Stable@vger.kernel.org
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@oss.qualcomm.com>
Tested-by: Steev Klimaszewski <threeway@gmail.com> # Thinkpad X13s
Link: https://patch.msgid.link/20251022143349.1081513-2-srinivas.kandagatla@oss.qualcomm.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
History 2026-01-08 10:15:04 +01:00
..
qdsp6 ASoC: qcom: qdsp6: q6asm-dai: set 10 ms period and buffer alignment. 2026-01-08 10:14:39 +01:00
apq8016_sbc.c ASoC: qcom: Use snd_soc_substream_to_rtd() for accessing private_data 2024-05-06 23:59:47 +09:00
apq8096.c ASoC: qcom: Fix trivial code style issues 2023-12-18 14:04:25 +00:00
common.c ASoC: remove snd_soc_dai_link_set_capabilities() 2024-08-22 13:36:46 +01:00
common.h ASoC: qcom: common: add Display port Jack function 2024-06-18 14:20:09 +01:00
Kconfig ASoC: qcom: sc7280: Fix missing Soundwire runtime stream alloc 2024-10-22 21:00:38 +01:00
lpass-apq8016.c ASoC: Switch back to struct platform_driver::remove() 2024-09-09 18:26:49 +01:00
lpass-cdc-dma.c ASoC: qcom: Fix uninitialized pointer dmactl 2024-02-21 14:01:17 +00:00
lpass-cpu.c ASoC: qcom: Fix NULL Dereference in asoc_qcom_lpass_cpu_platform_probe() 2024-10-07 15:35:34 +01:00
lpass-hdmi.c ASoC: qcom: Fix trivial code style issues 2023-12-18 14:04:25 +00:00
lpass-hdmi.h ASoC: qcom: Add support for lpass hdmi driver 2020-10-08 20:27:34 +01:00
lpass-ipq806x.c ASoC: Switch back to struct platform_driver::remove() 2024-09-09 18:26:49 +01:00
lpass-lpaif-reg.h ASoC: qcom: Add register definition for codec rddma and wrdma 2022-02-24 20:21:42 +00:00
lpass-platform.c ASoC: qcom: use drvdata instead of component to keep id 2025-08-20 18:30:28 +02:00
lpass-sc7180.c ASoC: Switch back to struct platform_driver::remove() 2024-09-09 18:26:49 +01:00
lpass-sc7280.c ASoC: Switch back to struct platform_driver::remove() 2024-09-09 18:26:49 +01:00
lpass.h ASoC: qcom: Fix sc7280 lpass potential buffer overflow 2025-04-25 10:47:50 +02:00
Makefile ASoC: qcom: Use *-y instead of *-objs in Makefile 2024-05-08 11:39:26 +09:00
sc7180.c ASoC: qcom: Use snd_soc_substream_to_rtd() for accessing private_data 2024-05-06 23:59:47 +09:00
sc7280.c ASoC: qcom: sdw: fix memory leak for sdw_stream_runtime 2026-01-08 10:15:04 +01:00
sc8280xp.c ASoC: qcom: sdw: fix memory leak for sdw_stream_runtime 2026-01-08 10:15:04 +01:00
sdm845.c ASoC: qcom: sdm845: Add error handling in sdm845_slim_snd_hw_params() 2025-06-27 11:11:13 +01:00
sdw.c ASoC: qcom: sdw: fix memory leak for sdw_stream_runtime 2026-01-08 10:15:04 +01:00
sdw.h ASoC: qcom: sdw: fix memory leak for sdw_stream_runtime 2026-01-08 10:15:04 +01:00
sm8250.c ASoC: qcom: sdw: fix memory leak for sdw_stream_runtime 2026-01-08 10:15:04 +01:00
storm.c ASoC: qcom: Fix trivial code style issues 2023-12-18 14:04:25 +00:00
x1e80100.c ASoC: qcom: sdw: fix memory leak for sdw_stream_runtime 2026-01-08 10:15:04 +01:00