From 1929a78679064eb2fc1c611822d5fa910be75bb5 Mon Sep 17 00:00:00 2001 From: liaohj Date: Wed, 2 Oct 2019 14:43:27 +0800 Subject: [PATCH] tas25xx_algo:add protection for tas25xx_set_profile - fix StsHostTestCases - android.security.sts.Poc17_06#testPocCVE_2017_7369 - when sts test, the profile_id is negative value. as <3>[ 61.218757] tas25xx_set_profile profile_id=-2147479279,param_id=0 need to add protection. Change-Id: Ia8eb4dc7a1a7ae869e3a254ed3cd0fa6b329c04b Signed-off-by: liaohj Reviewed-on: https://gerrit.mot.com/1431155 SME-Granted: SME Approvals Granted SLTApproved: Slta Waiver Tested-by: Jira Key Reviewed-by: Wanlong Zhou Reviewed-by: Hujun Liao Submit-Approved: Jira Key --- sound/soc/codecs/tas25xx-algo.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sound/soc/codecs/tas25xx-algo.c b/sound/soc/codecs/tas25xx-algo.c index 66f50fc80de2..181240fccdbf 100644 --- a/sound/soc/codecs/tas25xx-algo.c +++ b/sound/soc/codecs/tas25xx-algo.c @@ -169,7 +169,7 @@ static int tas25xx_set_profile(struct snd_kcontrol *pKcontrol, int profile_id = pUcontrol->value.integer.value[0]; int param_id = 0; int max_number_of_profiles = sizeof(profile_index_text)/sizeof(profile_index_text[0]); - if (profile_id >= max_number_of_profiles) + if ((profile_id >= max_number_of_profiles) || (profile_id < 0)) return -EINVAL; pr_info("TI-SmartPA: %s: Setting profile %s", __func__, profile_index_text[profile_id]);