Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5e7226fe authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "ASoC: msm: qdsp6v2: return error when copy from userspace fails"

parents 961d86ba cd8d41ed
Loading
Loading
Loading
Loading
+11 −6
Original line number Diff line number Diff line
/* Copyright (c) 2012-2016, The Linux Foundation. All rights reserved.
/* Copyright (c) 2012-2017, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -814,20 +814,25 @@ static int msm_pcm_playback_copy(struct snd_pcm_substream *substream, int a,
			if (prtd->mode == MODE_PCM) {
				ret = copy_from_user(&buf_node->frame.voc_pkt,
							buf, count);
				if (ret) {
					pr_err("%s: copy from user failed %d\n",
					       __func__, ret);
					return -EFAULT;
				}
				buf_node->frame.pktlen = count;
			} else {
				ret = copy_from_user(&buf_node->frame,
							buf, count);
				if (buf_node->frame.pktlen >= count)
					buf_node->frame.pktlen = count -
					(sizeof(buf_node->frame.frm_hdr) +
					 sizeof(buf_node->frame.pktlen));
			}
				if (ret) {
					pr_err("%s: copy from user failed %d\n",
					       __func__, ret);
					return -EFAULT;
				}
				if (buf_node->frame.pktlen >= count)
					buf_node->frame.pktlen = count -
					(sizeof(buf_node->frame.frm_hdr) +
					 sizeof(buf_node->frame.pktlen));
			}
			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);