linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ASoC: codecs: fix out-of-bounds access on invalid clock config
@ 2025-05-26 19:18 Qasim Ijaz
  2025-05-27 13:27 ` Mark Brown
  0 siblings, 1 reply; 2+ messages in thread
From: Qasim Ijaz @ 2025-05-26 19:18 UTC (permalink / raw)
  To: lgirdwood, broonie, perex, tiwai, zhangyi; +Cc: linux-sound, linux-kernel

[-- 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


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] ASoC: codecs: fix out-of-bounds access on invalid clock config
  2025-05-26 19:18 [PATCH] ASoC: codecs: fix out-of-bounds access on invalid clock config Qasim Ijaz
@ 2025-05-27 13:27 ` Mark Brown
  0 siblings, 0 replies; 2+ messages in thread
From: Mark Brown @ 2025-05-27 13:27 UTC (permalink / raw)
  To: lgirdwood, perex, tiwai, zhangyi, Qasim Ijaz; +Cc: linux-sound, linux-kernel

On Mon, 26 May 2025 20:18:20 +0100, Qasim Ijaz wrote:
> 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.
> 
> 
> [...]

Applied to

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next

Thanks!

[1/1] ASoC: codecs: fix out-of-bounds access on invalid clock config
      commit: 16719d48197bbd8cff121b32acec67d954335437

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-05-27 13:27 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-05-26 19:18 [PATCH] ASoC: codecs: fix out-of-bounds access on invalid clock config Qasim Ijaz
2025-05-27 13:27 ` Mark Brown

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).