ASoC: Add backend user count check

Add backend user count check to protect the index
boundary.

Change-Id: Ic1b61d1f7130252cc54da0b16553858714988dbd
CRs-Fixed: 2009216
Signed-off-by: Walter Yang <yandongy@codeaurora.org>
This commit is contained in:
Walter Yang 2017-03-02 12:13:34 +08:00 • committed by Xiaojun Sang
commit 4f36922db2
2 changed files with 9 additions and 0 deletions

View file

@ -691,6 +691,11 @@ static int soc_compr_set_params_fe(struct snd_compr_stream *cstream,
cstream, &async_domain);
} else {
be_list[j++] = be;
if (j == DPCM_MAX_BE_USERS) {
dev_dbg(fe->dev,
"ASoC: MAX backend users!\n");
break;
}
}
}
for (i = 0; i < j; i++) {

View file

@ -2761,6 +2761,10 @@ void dpcm_be_dai_prepare_async(struct snd_soc_pcm_runtime *fe, int stream,
dpcm, domain);
} else {
dpcm_async[i++] = dpcm;
if (i == DPCM_MAX_BE_USERS) {
dev_dbg(fe->dev, "ASoC: MAX backend users!\n");
break;
}
}
}