]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
ASoC: qcom: sdw: fix memory leak for sdw_stream_runtime
authorSrinivas Kandagatla <srinivas.kandagatla@oss.qualcomm.com>
Wed, 22 Oct 2025 14:33:46 +0000 (15:33 +0100)
committerMark Brown <broonie@kernel.org>
Wed, 29 Oct 2025 14:54:38 +0000 (14:54 +0000)
commitbcba17279327c6e85dee6a97014dc642e2dc93cc
treead7d3414fc45dda811981286311df9c1a7179340
parent45f5c9eec43a9bf448f46562f146810831916cc9
ASoC: qcom: sdw: fix memory leak for sdw_stream_runtime

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: d32bac9cb09c ("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>
sound/soc/qcom/sc7280.c
sound/soc/qcom/sc8280xp.c
sound/soc/qcom/sdw.c
sound/soc/qcom/sdw.h
sound/soc/qcom/sm8250.c
sound/soc/qcom/x1e80100.c