提交 362fe4de 编写于 作者: M Mark Brown 提交者: Zheng Zengkai

ASoC: ops: Reject out of bounds values in snd_soc_put_xr_sx()

stable inclusion
from stable-v5.10.99
commit 6877f87579ed830f9ff6d478539074f035d04bfb
bugzilla: https://gitee.com/openeuler/kernel/issues/I55O7H

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=6877f87579ed830f9ff6d478539074f035d04bfb

--------------------------------

commit 4cf28e9a upstream.

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: NMark Brown <broonie@kernel.org>
Cc: stable@vger.kernel.org
Link: https://lore.kernel.org/r/20220124153253.3548853-4-broonie@kernel.orgSigned-off-by: NMark Brown <broonie@kernel.org>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: NYu Liao <liaoyu15@huawei.com>
Reviewed-by: NWei Li <liwei391@huawei.com>
Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
上级 ddc1d1cf
......@@ -880,6 +880,8 @@ int snd_soc_put_xr_sx(struct snd_kcontrol *kcontrol,
unsigned int i, regval, regmask;
int err;
if (val < mc->min || val > mc->max)
return -EINVAL;
if (invert)
val = max - val;
val &= mask;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册