Skip to content

Commit

Permalink
ASoC: msm: q6: check upper bounds when copy ac3 params
Browse files Browse the repository at this point in the history
Although AC3 maximum param size is fixed, better check upper bounds
when copy user data. It might cause overflow, possibly cause memory
corruption.

Change-Id: Iaded762f774c608e48e685d92204fc7516aa3063
Signed-off-by: Fred Oh <fred@codeaurora.org>
  • Loading branch information
Fred Oh committed Nov 12, 2013
1 parent 407e563 commit 588b341
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions sound/soc/msm/qdsp6v2/msm-compr-q6-v2.c
Expand Up @@ -986,7 +986,7 @@ static int msm_compr_ioctl(struct snd_pcm_substream *substream,
struct snd_dec_ddp *ddp =
&compr->info.codec_param.codec.options.ddp;
uint32_t params_length = ddp->params_length*sizeof(int);
if(params_length > MAX_AC3_PARAM_SIZE) {
if (params_length > MAX_AC3_PARAM_SIZE) {
/*MAX is 36*sizeof(int) this should not happen*/
pr_err("params_length(%d) is greater than %d",
params_length, MAX_AC3_PARAM_SIZE);
Expand Down Expand Up @@ -1023,7 +1023,7 @@ static int msm_compr_ioctl(struct snd_pcm_substream *substream,
struct snd_dec_ddp *ddp =
&compr->info.codec_param.codec.options.ddp;
uint32_t params_length = ddp->params_length*sizeof(int);
if(params_length > MAX_AC3_PARAM_SIZE) {
if (params_length > MAX_AC3_PARAM_SIZE) {
/*MAX is 36*sizeof(int) this should not happen*/
pr_err("params_length(%d) is greater than %d",
params_length, MAX_AC3_PARAM_SIZE);
Expand Down

0 comments on commit 588b341

Please sign in to comment.