From: Qasim Ijaz <qasdev00@gmail.com>
To: lgirdwood@gmail.com, broonie@kernel.org, perex@perex.cz,
tiwai@suse.com, zhangyi@everest-semi.com
Cc: linux-sound@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH] ASoC: codecs: fix out-of-bounds access on invalid clock config
Date: Mon, 26 May 2025 20:18:20 +0100 [thread overview]
Message-ID: <20250526191820.72577-1-qasdev00@gmail.com> (raw)
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=n, Size: 910 bytes --]
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>
---
sound/soc/codecs/es8375.c | 1 +
1 file changed, 1 insertion(+)
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);
--
2.39.5
next reply other threads:[~2025-05-26 19:18 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-26 19:18 Qasim Ijaz [this message]
2025-05-27 13:27 ` [PATCH] ASoC: codecs: fix out-of-bounds access on invalid clock config Mark Brown
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250526191820.72577-1-qasdev00@gmail.com \
--to=qasdev00@gmail.com \
--cc=broonie@kernel.org \
--cc=lgirdwood@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-sound@vger.kernel.org \
--cc=perex@perex.cz \
--cc=tiwai@suse.com \
--cc=zhangyi@everest-semi.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).