mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-10 22:40:54 -04:00
ASoC: cs35l41: Add out of bound check for mixer
Program such as nanomix allows out of bound input to mixer, which may crash kernel. This issue is found by Google test (LENOVO-848). Add out of bound check for mixer to prevent kernel crash. Mot-Crs-fixed:(CR) Change-Id: I4c0437cfd2d2570a9c9489db500cffc513f27c43 Signed-off-by: Li Xu <li.xu@cirrus.com> Reviewed-on: https://gerrit.mot.com/1253050 SME-Granted: SME Approvals Granted SLTApproved: Slta Waiver Tested-by: Jira Key Reviewed-by: Guobin Zhang <zhanggb@motorola.com> Submit-Approved: Jira Key Reviewed-on: https://gerrit.mot.com/1253083
This commit is contained in:
parent
e5e452b839
commit
ae431b8af0
1 changed files with 7 additions and 2 deletions
|
|
@ -317,12 +317,17 @@ static int cs35l41_cspl_cmd_put(struct snd_kcontrol *kcontrol,
|
|||
struct cs35l41_private *cs35l41 = snd_soc_codec_get_drvdata(codec);
|
||||
struct soc_enum *soc_enum;
|
||||
unsigned int i = ucontrol->value.enumerated.item[0];
|
||||
int ret = 0;
|
||||
|
||||
soc_enum = (struct soc_enum *)kcontrol->private_value;
|
||||
|
||||
if (i >= soc_enum->items) {
|
||||
dev_err(codec->dev, "Invalid mixer input (%u)\n", i);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
cs35l41->cspl_cmd = soc_enum->values[i];
|
||||
|
||||
return ret;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int cs35l41_cspl_cmd_get(struct snd_kcontrol *kcontrol,
|
||||
|
|
|
|||
Loading…
Reference in a new issue