Add check of input value's range in fsl_easrc_iec958_put_bits(), otherwise the wrong value may be written from user space.
Unified · Split
| @@ -54,6 +54,9 @@ static int fsl_easrc_iec958_put_bits(struct snd_kcontrol *kcontrol, · 53 unmodified lines | |||
| 54 | unsigned int regval = ucontrol->value.integer.value[0]; | 54 | unsigned int regval = ucontrol->value.integer.value[0]; |
| 55 | int ret; | 55 | int ret; |
| 56 | 56 | ||
| 57 | if (regval < EASRC_WIDTH_16_BIT || regval > EASRC_WIDTH_24_BIT) | ||
| 58 | return -EINVAL; | ||
| 59 | |||
| 57 | ret = (easrc_priv->bps_iec958[mc->regbase] != regval); | 60 | ret = (easrc_priv->bps_iec958[mc->regbase] != regval); |
| 58 | 61 | ||
| 59 | easrc_priv->bps_iec958[mc->regbase] = regval; | 62 | easrc_priv->bps_iec958[mc->regbase] = regval; |