diff options
author | Qasim Ijaz <qasdev00@gmail.com> | 2025-05-26 20:18:20 +0100 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2025-05-27 12:12:17 +0100 |
commit | 16719d48197bbd8cff121b32acec67d954335437 (patch) | |
tree | e313a11b6ba2ef8ad82fe3d32580cef5d901ec00 | |
parent | f4ba2ea57da51d616b689c4b8826c517ff5a8523 (diff) |
ASoC: codecs: fix out-of-bounds access on invalid clock config
get_coeff() returns –EINVAL when no table entry matches.
The driver then uses that value as an index into coeff_div[],
causing an OOB access.
To fix lets abort the hw_params call instead.
Fixes: de2b3119f9f7 ("ASoC: codecs: add support for ES8375")
Signed-off-by: Qasim Ijaz <qasdev00@gmail.com>
Link: https://patch.msgid.link/20250526191820.72577-1-qasdev00@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
-rw-r--r-- | sound/soc/codecs/es8375.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/sound/soc/codecs/es8375.c b/sound/soc/codecs/es8375.c index decc86c92427..009259632107 100644 --- a/sound/soc/codecs/es8375.c +++ b/sound/soc/codecs/es8375.c @@ -319,6 +319,7 @@ static int es8375_hw_params(struct snd_pcm_substream *substream, coeff = get_coeff(es8375->vddd, dmic_enable, es8375->mclk_freq, params_rate(params)); if (coeff < 0) { dev_warn(component->dev, "Clock coefficients do not match"); + return coeff; } regmap_write(es8375->regmap, ES8375_CLK_MGR4, coeff_div[coeff].Reg0x04); |