Skip to content

Commit 2fbe467

Browse files
committed
ASoC: max98090: Reject invalid values in custom control put()
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 <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mark Brown <[email protected]>
1 parent 87c1851 commit 2fbe467

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

sound/soc/codecs/max98090.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -413,6 +413,9 @@ static int max98090_put_enab_tlv(struct snd_kcontrol *kcontrol,
413413

414414
val = (val >> mc->shift) & mask;
415415

416+
if (sel < 0 || sel > mc->max)
417+
return -EINVAL;
418+
416419
*select = sel;
417420

418421
/* Setting a volume is only valid if it is already On */

0 commit comments

Comments
 (0)