mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-16 08:44:21 +08:00
ASoC: max98090: Reject invalid values in custom control put()
[ Upstream commit 2fbe467bcb
]
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 <broonie@kernel.org>
Link: https://lore.kernel.org/r/20220420193454.2647908-1-broonie@kernel.org
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
e1d387eead
commit
081188d82e
@ -413,6 +413,9 @@ static int max98090_put_enab_tlv(struct snd_kcontrol *kcontrol,
|
||||
|
||||
val = (val >> mc->shift) & mask;
|
||||
|
||||
if (sel < 0 || sel > mc->max)
|
||||
return -EINVAL;
|
||||
|
||||
*select = sel;
|
||||
|
||||
/* Setting a volume is only valid if it is already On */
|
||||
|
Loading…
Reference in New Issue
Block a user