summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBubble Fang <bubblefang@google.com>2023-12-26 04:01:00 +0000
committerBubble Fang <bubblefang@google.com>2023-12-26 04:03:05 +0000
commitab2f61ef6f914b913061eb9ad9d1127a4257839d (patch)
tree4d03616d66c3c91f8418165242cf8dbef08cd13f
parent598e8ee7a25df36d352e311f29667351f03ef6ef (diff)
downloadmsm-extra-ab2f61ef6f914b913061eb9ad9d1127a4257839d.tar.gz
ASoC: msm-audio-effects-q6-v2: Add BPF order check
Added check for bandpassfilter order in order to avoid coeff len going out of bounds thereby leading to memory overflow issues. Bug: 309463056 Change-Id: I59c9a53c5965ae4b68df0524af754c34c7c384d0 Signed-off-by: Bubble Fang <bubblefang@google.com>
-rw-r--r--asoc/msm-audio-effects-q6-v2.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/asoc/msm-audio-effects-q6-v2.c b/asoc/msm-audio-effects-q6-v2.c
index db3bd87e..f415e699 100644
--- a/asoc/msm-audio-effects-q6-v2.c
+++ b/asoc/msm-audio-effects-q6-v2.c
@@ -1,5 +1,6 @@
// SPDX-License-Identifier: GPL-2.0-only
/* Copyright (c) 2013-2019, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2023, Qualcomm Innovation Center, Inc. All rights reserved.
*/
#include <linux/slab.h>
@@ -1002,6 +1003,14 @@ int msm_audio_effects_pbe_handler(struct audio_client *ac,
pbe->config.reserved =
GET_NEXT(values, param_max_offset, rc);
+ if ((pbe->config.bandpass_filter_order > 3) ||
+ (pbe->config.bandpass_filter_order < 1)) {
+ pr_err("%s: Invalid BPF order\n",
+ __func__);
+ rc = -EINVAL;
+ goto invalid_config;
+ }
+
p_coeffs = &pbe->config.p1LowPassCoeffs[0];
lpf_len = (pbe->config.xover_filter_order == 3) ? 10 : 5;
hpf_len = (pbe->config.xover_filter_order == 3) ? 10 : 5;