From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8A66044AB68; Tue, 21 Jul 2026 21:27:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784669225; cv=none; b=NRpQipkoTFJMdaullq5WqmRefbblEnEjL5Z8+MCFmUbPR73r2tAnn7Z9FollwNeK6fSRtqkzNFDW1ijMxZa5p/b5hUc+RcQK2WKk0ARG/TGno4M8lrSKZ137uYaGmgju0T0B7z6V7LW/XFpVif0po8oCwAmULeedLA2K+rXhax0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784669225; c=relaxed/simple; bh=vv8s9QUNJtxMEriak3Q28ildzSPyS9x/4q8vtMgFyIs=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=lEo9juUn2PLUdOW/1s3MhsuxFwEj75l4gdPY/JD2QQjnsPzqYJ3sRztwoN+/i8u9zjMAkKtwMcs9UiaJpCZd235J1LsrSNM7e8VdpDfBoJX2ahsX/KSIU8CnJMnW3uFnVYtv3+U3kpZRCOaP1I5dCtlB0r/AAjQV03YEtZyicH0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=E5qNAv/i; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="E5qNAv/i" Received: by smtp.kernel.org (Postfix) with ESMTPSA id EEA811F000E9; Tue, 21 Jul 2026 21:27:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1784669224; bh=8Uq6PQWVmHyn6NzIwN1lXA/VPHNnmvcmQHlG2oQ9p98=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=E5qNAv/ixd75jzoXT1OtTh6Z1v+aOfkQw/qcfYz9NVsM5BVmORIb2/aXksp98NJ7A FIl4ta3B7bGcRDZe47QeXFwitHT+BXBrW1QcvB6CwyswWk6bPOK6DIy5TiXuFPBXnJ uIx4TP3RRXgVd42+3Fcl4+Af8BL8Qvz2hn/BcOTs= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, HyeongJun An , Mark Brown , Sasha Levin Subject: [PATCH 6.1 0431/1067] ASoC: tegra: tegra210_ahub: Validate written enum value Date: Tue, 21 Jul 2026 17:17:12 +0200 Message-ID: <20260721152434.259995560@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260721152424.521567757@linuxfoundation.org> References: <20260721152424.521567757@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.1-stable review patch. If anyone has any objections, please let me know. ------------------ From: HyeongJun An [ Upstream commit 1d8aabb413b5638670dfd1162169edc0ba276a2e ] tegra_ahub_put_value_enum() reads e->values[item[0]] before checking whether item[0] is within the enum item range. The existing check therefore happens too late to prevent an out-of-range read of the values array. Move the check before the array access. Fixes: 16e1bcc2caf4 ("ASoC: tegra: Add Tegra210 based AHUB driver") Assisted-by: Claude:claude-opus-4-8 Signed-off-by: HyeongJun An Link: https://patch.msgid.link/20260609124317.38046-5-sammiee5311@gmail.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- sound/soc/tegra/tegra210_ahub.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sound/soc/tegra/tegra210_ahub.c b/sound/soc/tegra/tegra210_ahub.c index 4be56835041546..6dcd7efe0802e9 100644 --- a/sound/soc/tegra/tegra210_ahub.c +++ b/sound/soc/tegra/tegra210_ahub.c @@ -60,13 +60,15 @@ static int tegra_ahub_put_value_enum(struct snd_kcontrol *kctl, struct soc_enum *e = (struct soc_enum *)kctl->private_value; struct snd_soc_dapm_update update[TEGRA_XBAR_UPDATE_MAX_REG] = { }; unsigned int *item = uctl->value.enumerated.item; - unsigned int value = e->values[item[0]]; + unsigned int value; unsigned int i, bit_pos, reg_idx = 0, reg_val = 0; int change = 0; if (item[0] >= e->items) return -EINVAL; + value = e->values[item[0]]; + if (value) { /* Get the register index and value to set */ reg_idx = (value - 1) / (8 * cmpnt->val_bytes); -- 2.53.0