[PATCH] ASoC: wm8994: Fix potential DSP control text array leaks

From: Guangshuo Li

Date: Thu Nov 12 2026 - 09:09:33 EST


wm8958_dsp2_init() allocates text arrays for the DSP mode controls,
but component removal does not free them.

Release the arrays on removal and clear their pointers so a later
component probe that stops partway through allocation cannot leave
old pointers for the next removal.

This issue was found by our static analysis tool under development.

Fixes: 131d81061eba ("ASoC: Allow user-specified WM8958 multiband compressor configurations")
Signed-off-by: Guangshuo Li <liguangshuo@xxxxxxxxxxxxxxx>
---
sound/soc/codecs/wm8994.c | 8 ++++++++
1 file changed, 8 insertions(+)

diff --git a/sound/soc/codecs/wm8994.c b/sound/soc/codecs/wm8994.c
index 6b91e02f130b..1c7619f1d481 100644
--- a/sound/soc/codecs/wm8994.c
+++ b/sound/soc/codecs/wm8994.c
@@ -4640,6 +4640,14 @@ static void wm8994_component_remove(struct snd_soc_component *component)
release_firmware(wm8994->mbc_vss);
release_firmware(wm8994->enh_eq);
kfree(wm8994->retune_mobile_texts);
+ kfree(wm8994->mbc_texts);
+ kfree(wm8994->vss_texts);
+ kfree(wm8994->vss_hpf_texts);
+ kfree(wm8994->enh_eq_texts);
+ wm8994->mbc_texts = NULL;
+ wm8994->vss_texts = NULL;
+ wm8994->vss_hpf_texts = NULL;
+ wm8994->enh_eq_texts = NULL;
}

static const struct snd_soc_component_driver soc_component_dev_wm8994 = {

base-commit: 6628e7d4c6b25c8d18f1345e3a20d21829aae7e4