]> 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>
Mon, 5 Jan 2026 15:10:08 +0000 (10:10 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 8 Jan 2026 09:15:04 +0000 (10:15 +0100)
commit985131a81ef6ffbbda082fe8cda039f8dfe173b0
tree668481346f71ca789fc31d0d74f20ef5989db2d6
parent28b2ec0662a817043f76900e131cc5376c2df725
ASoC: qcom: sdw: fix memory leak for sdw_stream_runtime

[ Upstream commit bcba17279327c6e85dee6a97014dc642e2dc93cc ]

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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.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