summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWilson Sung <wilsonsung@google.com>2023-03-06 16:11:04 +0800
committerWilson Sung <wilsonsung@google.com>2023-03-06 16:11:04 +0800
commit2fddaa62990fba072286b4270d6dc5e62adeaac6 (patch)
tree5fcdbe8a6aecfcfa154b4e87241397ee6e548770
parent8540cb6038deabc130f3934095a97e731147516f (diff)
parenta4374817ccc8686f86aa708243ecda95da28e216 (diff)
downloadmsm-extra-2fddaa62990fba072286b4270d6dc5e62adeaac6.tar.gz
Merge branch 'LA.UM.9.12.C10.11.00.00.840.535' via branch 'qcom-msm-4.19-7250-audio-drivers.lnx.4.0.r3' into android-msm-pixel-4.19
Change-Id: Ia5bd6362505ae2c799c07f2942fc7d7e786a5166
-rw-r--r--asoc/msm-pcm-q6-v2.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/asoc/msm-pcm-q6-v2.c b/asoc/msm-pcm-q6-v2.c
index e6a5c1a7..04c6eec3 100644
--- a/asoc/msm-pcm-q6-v2.c
+++ b/asoc/msm-pcm-q6-v2.c
@@ -1,5 +1,6 @@
// SPDX-License-Identifier: GPL-2.0-only
/* Copyright (c) 2012-2021, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights reserved.
*/
@@ -1007,6 +1008,14 @@ static int msm_pcm_capture_copy(struct snd_pcm_substream *substream,
xfer = size;
offset = prtd->in_frame_info[idx].offset;
pr_debug("Offset value = %d\n", offset);
+
+ if (offset >= size) {
+ pr_err("%s: Invalid dsp buf offset\n", __func__);
+ ret = -EFAULT;
+ q6asm_cpu_buf_release(OUT, prtd->audio_client);
+ goto fail;
+ }
+
if (size == 0 || size < prtd->pcm_count) {
memset(bufptr + offset + size, 0, prtd->pcm_count - size);
if (fbytes > prtd->pcm_count)