Skip to content

Commit 4cf28e9

Browse files
committed
ASoC: ops: Reject out of bounds values in snd_soc_put_xr_sx()
We don't currently validate that the values being set are within the range we advertised to userspace as being valid, do so and reject any values that are out of range. Signed-off-by: Mark Brown <[email protected]> Cc: [email protected] Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mark Brown <[email protected]>
1 parent 4f1e50d commit 4cf28e9

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

sound/soc/soc-ops.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -879,6 +879,8 @@ int snd_soc_put_xr_sx(struct snd_kcontrol *kcontrol,
879879
long val = ucontrol->value.integer.value[0];
880880
unsigned int i;
881881

882+
if (val < mc->min || val > mc->max)
883+
return -EINVAL;
882884
if (invert)
883885
val = max - val;
884886
val &= mask;

0 commit comments

Comments
 (0)