From e7ca214c29dc37f0175a22306f6ba4df04599d98 Mon Sep 17 00:00:00 2001 From: Harshal Ahire Date: Fri, 5 Jun 2020 14:15:21 +0530 Subject: [PATCH] dsp: Fix out of bound memory access. Fix out of bound memory access in q6afe_load_avcs_modules() for afe_avcs_payload_port_mapping structure. Change-Id: Ibe0e90e4fbedc2cf6a88abd9f3845643020a904a --- dsp/q6afe.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/dsp/q6afe.c b/dsp/q6afe.c index ba84bd82ad04..b00952708f61 100644 --- a/dsp/q6afe.c +++ b/dsp/q6afe.c @@ -359,8 +359,12 @@ load_unload: } } - pr_err("%s: Not enough ports available\n", __func__); + ret = -EINVAL; + if (i == MAX_ALLOWED_USE_CASES) { + pr_err("%s: Not enough ports available\n", __func__); + return ret; + } fail: kfree(pm[i]->payload); pm[i]->payload = NULL;