From patchwork Fri Apr 5 17:11:47 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mikhail Kobuk X-Patchwork-Id: 786715 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 5A1B8CD128A for ; Sun, 7 Apr 2024 07:25:06 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 46ADF2BE3; Sun, 7 Apr 2024 09:24:54 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 46ADF2BE3 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1712474704; bh=jp/ItmKjNW3lwD3HqdoO06DYpz1adMSLKDyVPElM/+g=; h=From:To:Cc:Subject:Date:List-Id:List-Archive:List-Help:List-Owner: List-Post:List-Subscribe:List-Unsubscribe:From; b=L5VawdFEsxlqexlD/DP9MYA5m84Sonnl5zG/3412WFggkqAgysL+sNJbW/XApvWAE 1XbgHuCakmF2E8n6/u+NtNAZ9n8LN6eCHfyri3taQSvQSOFvIPQlxMe1tyzm8/NXFP 6Fw6EUXGkRBJwAsXjZx+5ha6Hb8qJ1ADysKk/x20= Received: by alsa1.perex.cz (Postfix, from userid 50401) id 11777F897BA; Sun, 7 Apr 2024 09:18:20 +0200 (CEST) Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id 91216F897BD; Sun, 7 Apr 2024 09:18:20 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id DA737F8020D; Fri, 5 Apr 2024 19:12:10 +0200 (CEST) Received: from mail.ispras.ru (mail.ispras.ru [83.149.199.84]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 55923F80007 for ; Fri, 5 Apr 2024 19:11:59 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 55923F80007 Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key, unprotected) header.d=ispras.ru header.i=@ispras.ru header.a=rsa-sha256 header.s=default header.b=eVDQ7fDg Received: from tundra.lovozera (unknown [178.176.73.54]) by mail.ispras.ru (Postfix) with ESMTPSA id 33E7440737DC; Fri, 5 Apr 2024 17:11:57 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 mail.ispras.ru 33E7440737DC DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ispras.ru; s=default; t=1712337118; bh=zxli1M6t4+mmVUuqsEAwsb92XAAipwuHZ0h0RJ1Q04E=; h=From:To:Cc:Subject:Date:From; b=eVDQ7fDg7MTjYAXLcnt/MpMf1pjj9763Prk9QR8SbfcHQDleljuaSVRU5eRdI3Ldu AHjNVIpvKJBaE2WOH9fFa900b5O5CoF32/I3cC7gHHTpsiUqS3zdGC95FFvSDvg48M MdE2Sds5BvS+ruCEmn7RDKwFLXyUbUYCKXi3FGrc= From: Mikhail Kobuk To: Srinivas Kandagatla Cc: Mikhail Kobuk , Banajit Goswami , Liam Girdwood , Mark Brown , Jaroslav Kysela , Takashi Iwai , Srinivasa Rao Mandadapu , Venkata Prasad Potturu , alsa-devel@alsa-project.org, linux-sound@vger.kernel.org, linux-kernel@vger.kernel.org, lvc-project@linuxtesting.org, Fedor Pchelkin , Alexey Khoroshilov , stable@vger.kernel.org Subject: [PATCH] ASoC: qcom: Fix out of bounds access Date: Fri, 5 Apr 2024 20:11:47 +0300 Message-ID: <20240405171148.12665-1-m.kobuk@ispras.ru> X-Mailer: git-send-email 2.44.0 MIME-Version: 1.0 X-MailFrom: m.kobuk@ispras.ru X-Mailman-Rule-Hits: nonmember-moderation X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-alsa-devel.alsa-project.org-0; header-match-alsa-devel.alsa-project.org-1 Message-ID-Hash: GQMQHTUNETEYNJXINRQI3PSFNSOV4YLF X-Message-ID-Hash: GQMQHTUNETEYNJXINRQI3PSFNSOV4YLF X-Mailman-Approved-At: Sun, 07 Apr 2024 07:15:59 +0000 X-Mailman-Version: 3.3.9 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Case values introduced in commit 5f78e1fb7a3e ("ASoC: qcom: Add driver support for audioreach solution") cause out of bounds access in arrays of sc7280 driver data (e.g. in case of RX_CODEC_DMA_RX_0 in sc7280_snd_hw_params()). Redefine LPASS_MAX_PORTS to consider the maximum possible port id for q6dsp as sc7280 driver utilizes some of those values. Found by Linux Verification Center (linuxtesting.org) with SVACE. Fixes: 77d0ffef793d ("ASoC: qcom: Add macro for lpass DAI id's max limit") Cc: Signed-off-by: Mikhail Kobuk --- sound/soc/qcom/lpass.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sound/soc/qcom/lpass.h b/sound/soc/qcom/lpass.h index 27a2bf9a6613..10a507c95312 100644 --- a/sound/soc/qcom/lpass.h +++ b/sound/soc/qcom/lpass.h @@ -13,10 +13,11 @@ #include #include #include +#include #include "lpass-hdmi.h" #define LPASS_AHBIX_CLOCK_FREQUENCY 131072000 -#define LPASS_MAX_PORTS (LPASS_CDC_DMA_VA_TX8 + 1) +#define LPASS_MAX_PORTS (QUINARY_MI2S_TX + 1) #define LPASS_MAX_MI2S_PORTS (8) #define LPASS_MAX_DMA_CHANNELS (8) #define LPASS_MAX_HDMI_DMA_CHANNELS (4)