History

ASoC: fsl_easrc: Check the variable range in fsl_easrc_iec958_put_bits()

Add check of input value's range in fsl_easrc_iec958_put_bits(), otherwise the wrong value may be written from user space.

Shengjiu Wang committed 7 months ago

Commit 00541b81 parent 64a496b1 file · +3 −0Browse files

Unified · Split

sound/soc/fsl/fsl_easrc.c+3−0
@@ -54,6 +54,9 @@ static int fsl_easrc_iec958_put_bits(struct snd_kcontrol *kcontrol, · 53 unmodified lines
5454 unsigned int regval = ucontrol->value.integer.value[0];
5555 int ret;
5656
57+ if (regval < EASRC_WIDTH_16_BIT || regval > EASRC_WIDTH_24_BIT)
58+ return -EINVAL;
59+
5760 ret = (easrc_priv->bps_iec958[mc->regbase] != regval);
5861
5962 easrc_priv->bps_iec958[mc->regbase] = regval;