Skip to content

Commit

Permalink
ASoC: msm: qdsp6v2: return error when copy from userspace fails
Browse files Browse the repository at this point in the history
A copy_from_user is not always expected to succeed. Therefore, check
for an error before operating on the buffer post copy.

CAF-Change-Id: Ibba9a47c84e735d30e32eeac5b80d51044b7a9e8
CRs-Fixed: 1094852
Signed-off-by: Siena Richard <[email protected]>

CVE-2017-0610

Change-Id: I238dd28d531778104660ff5ac9b8a9733c2fac6a
(cherry picked from commit 65009746a6e649779f73d665934561ea983892fe)
Signed-off-by: Francisco Franco <[email protected]>
  • Loading branch information
Siena Richard authored and franciscofranco committed Nov 7, 2017
1 parent e407c45 commit 890cadd
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
5 changes: 5 additions & 0 deletions sound/soc/msm/msm-pcm-voip.c
Original file line number Diff line number Diff line change
Expand Up @@ -693,6 +693,11 @@ static int msm_pcm_playback_copy(struct snd_pcm_substream *substream, int a,
} else
ret = copy_from_user(&buf_node->frame,
buf, count);
if (ret) {
pr_err("%s: copy from user failed %d\n",
__func__, ret);
return -EFAULT;
}
spin_lock_irqsave(&prtd->dsp_lock, dsp_flags);
list_add_tail(&buf_node->list, &prtd->in_queue);
spin_unlock_irqrestore(&prtd->dsp_lock, dsp_flags);
Expand Down
5 changes: 5 additions & 0 deletions sound/soc/msm/qdsp6v2/msm-pcm-voip-v2.c
Original file line number Diff line number Diff line change
Expand Up @@ -563,6 +563,11 @@ static int msm_pcm_playback_copy(struct snd_pcm_substream *substream, int a,
} else
ret = copy_from_user(&buf_node->frame,
buf, count);
if (ret) {
pr_err("%s: copy from user failed %d\n",
__func__, ret);
return -EFAULT;
}
spin_lock_irqsave(&prtd->dsp_lock, dsp_flags);
list_add_tail(&buf_node->list, &prtd->in_queue);
spin_unlock_irqrestore(&prtd->dsp_lock, dsp_flags);
Expand Down

0 comments on commit 890cadd

Please sign in to comment.