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

Commit 7f937960 authored by Sandhya Mutha Naga Venkata's avatar Sandhya Mutha Naga Venkata Committed by Manish Chaturvedi
Browse files

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.

Change-Id: I401f5f38a3d54d9d6af66e770d03629ed5e1a2bd
Signed-off-by: default avatarSoumya Managoli <quic_c_smanag@quicinc.com>
(cherry picked from commit a225b1346d434fb0ceec5c81718879f402d31373)
(cherry picked from commit 83eea8aa0fd343f103d19168f31314717fa5f3aa)
(cherry picked from commit 2e063ef2)
parent 7e5dbf0a
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
// 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;