All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] ASoC: max98090: Reject invalid values in custom control put()
@ 2022-04-20 19:34 Mark Brown
  2022-04-20 19:34 ` [PATCH 2/2] ASoC: max98090: Generate notifications on changes for custom control Mark Brown
  2022-04-25 16:00 ` [PATCH 1/2] ASoC: max98090: Reject invalid values in custom control put() Mark Brown
  0 siblings, 2 replies; 3+ messages in thread
From: Mark Brown @ 2022-04-20 19:34 UTC (permalink / raw)
  To: Mark Brown, Liam Girdwood; +Cc: alsa-devel

The max98090 driver has a custom put function for some controls which can
only be updated in certain circumstances which makes no effort to validate
that input is suitable for the control, allowing out of spec values to be
written to the hardware and presented to userspace. Fix this by returning
an error when invalid values are written.

Signed-off-by: Mark Brown <broonie@kernel.org>
---
 sound/soc/codecs/max98090.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/sound/soc/codecs/max98090.c b/sound/soc/codecs/max98090.c
index b45ec35cd63c..6d9261346842 100644
--- a/sound/soc/codecs/max98090.c
+++ b/sound/soc/codecs/max98090.c
@@ -413,6 +413,9 @@ static int max98090_put_enab_tlv(struct snd_kcontrol *kcontrol,
 
 	val = (val >> mc->shift) & mask;
 
+	if (sel < 0 || sel > mc->max)
+		return -EINVAL;
+
 	*select = sel;
 
 	/* Setting a volume is only valid if it is already On */
-- 
2.30.2


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

* [PATCH 2/2] ASoC: max98090: Generate notifications on changes for custom control
  2022-04-20 19:34 [PATCH 1/2] ASoC: max98090: Reject invalid values in custom control put() Mark Brown
@ 2022-04-20 19:34 ` Mark Brown
  2022-04-25 16:00 ` [PATCH 1/2] ASoC: max98090: Reject invalid values in custom control put() Mark Brown
  1 sibling, 0 replies; 3+ messages in thread
From: Mark Brown @ 2022-04-20 19:34 UTC (permalink / raw)
  To: Mark Brown, Liam Girdwood; +Cc: alsa-devel

The max98090 driver has some custom controls which share a put() function
which returns 0 unconditionally, meaning that events are not generated
when the value changes. Fix that.

Signed-off-by: Mark Brown <broonie@kernel.org>
---
 sound/soc/codecs/max98090.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sound/soc/codecs/max98090.c b/sound/soc/codecs/max98090.c
index 6d9261346842..62b41ca050a2 100644
--- a/sound/soc/codecs/max98090.c
+++ b/sound/soc/codecs/max98090.c
@@ -430,7 +430,7 @@ static int max98090_put_enab_tlv(struct snd_kcontrol *kcontrol,
 		mask << mc->shift,
 		sel << mc->shift);
 
-	return 0;
+	return *select != val;
 }
 
 static const char *max98090_perf_pwr_text[] =
-- 
2.30.2


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

* Re: [PATCH 1/2] ASoC: max98090: Reject invalid values in custom control put()
  2022-04-20 19:34 [PATCH 1/2] ASoC: max98090: Reject invalid values in custom control put() Mark Brown
  2022-04-20 19:34 ` [PATCH 2/2] ASoC: max98090: Generate notifications on changes for custom control Mark Brown
@ 2022-04-25 16:00 ` Mark Brown
  1 sibling, 0 replies; 3+ messages in thread
From: Mark Brown @ 2022-04-25 16:00 UTC (permalink / raw)
  To: lgirdwood, broonie; +Cc: alsa-devel

On Wed, 20 Apr 2022 20:34:53 +0100, Mark Brown wrote:
> The max98090 driver has a custom put function for some controls which can
> only be updated in certain circumstances which makes no effort to validate
> that input is suitable for the control, allowing out of spec values to be
> written to the hardware and presented to userspace. Fix this by returning
> an error when invalid values are written.
> 
> 
> [...]

Applied to

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

Thanks!

[1/2] ASoC: max98090: Reject invalid values in custom control put()
      commit: 2fbe467bcbfc760a08f08475eea6bbd4c2874319
[2/2] ASoC: max98090: Generate notifications on changes for custom control
      commit: 13fcf676d9e102594effc686d98521ff5c90b925

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] 3+ messages in thread

end of thread, other threads:[~2022-04-25 16:01 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-20 19:34 [PATCH 1/2] ASoC: max98090: Reject invalid values in custom control put() Mark Brown
2022-04-20 19:34 ` [PATCH 2/2] ASoC: max98090: Generate notifications on changes for custom control Mark Brown
2022-04-25 16:00 ` [PATCH 1/2] ASoC: max98090: Reject invalid values in custom control put() Mark Brown

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.