Skip to content

Commit 16719d4

Browse files
qasim-ijazbroonie
authored andcommitted
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: de2b311 ("ASoC: codecs: add support for ES8375") Signed-off-by: Qasim Ijaz <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Mark Brown <[email protected]>
1 parent f4ba2ea commit 16719d4

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

sound/soc/codecs/es8375.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -319,6 +319,7 @@ static int es8375_hw_params(struct snd_pcm_substream *substream,
319319
coeff = get_coeff(es8375->vddd, dmic_enable, es8375->mclk_freq, params_rate(params));
320320
if (coeff < 0) {
321321
dev_warn(component->dev, "Clock coefficients do not match");
322+
return coeff;
322323
}
323324
regmap_write(es8375->regmap, ES8375_CLK_MGR4,
324325
coeff_div[coeff].Reg0x04);

0 commit comments

Comments
 (0)