summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSoumya Managoli <smanag@codeaurora.org>2018-07-31 18:38:29 +0530
committerGerrit - the friendly Code Review server <code-review@localhost>2018-09-04 04:53:26 -0700
commit5206b51937f250d704ec39d990d3b574b87826d9 (patch)
tree72ff3ceaf164b1fedb1476e6f07c324e09610a8b
parentf09b84f8eaa7a14577888c1dc9a298301d3c839c (diff)
asoc : msm: Fix zero size pointer issue
APPS crashes randomly due to invalid memory allocation in q6asm_audio_client_buf_free_contiguous. Added check to return error if memory allocation size is 0. Change-Id: I40f49aa147d513b29b56224a5ee77ccbb2dcc110 CRs-Fixed: 2285272 Signed-off-by: Soumya Managoli <smanag@codeaurora.org>
-rw-r--r--sound/soc/msm/qdsp6v2/q6asm.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/sound/soc/msm/qdsp6v2/q6asm.c b/sound/soc/msm/qdsp6v2/q6asm.c
index 2f048fddcb08..3f90347d491c 100644
--- a/sound/soc/msm/qdsp6v2/q6asm.c
+++ b/sound/soc/msm/qdsp6v2/q6asm.c
@@ -1567,6 +1567,12 @@ int q6asm_audio_client_buf_alloc_contiguous(unsigned int dir,
pr_err("%s: buffer already allocated\n", __func__);
return 0;
}
+
+ if (bufcnt == 0) {
+ pr_err("%s: invalid buffer count\n", __func__);
+ return -EINVAL;
+ }
+
mutex_lock(&ac->cmd_lock);
buf = kzalloc(((sizeof(struct audio_buffer))*bufcnt),
GFP_KERNEL);