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 5EF03478E49; Sat, 12 Sep 2026 13:20:28 +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=1789219229; cv=none; b=Qj4mIfUqy71+JDTVeIkVewiRjnM1jrA6cS0uGfekQ4FI6ILAXTWTbPMya2w+NNtzH1htuLFWchOfmWzX9/9w0C/BfMwlJKzKTNWC9xHhoU0iBRzxDQmRJM/7zAdVj/Pa15B4OOJYRsDHPsmq0nSAOQaZ7R0SgHHdv4rJiaCD97k= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789219229; c=relaxed/simple; bh=N9Rv86XlY8jUOIByCHkJlC11lE44c0AkZYIFwq6u9mY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=oCONjXazrozdb7x0r4OlykHpJtJJG0564y26G7Mf1lTxXzu2ctNslOo8INmdQaYPSDY0tiRl9qqR1BU9aXy1jGVbGITQ5w8inBqjrDHgoyfGF3drITrRMKag+LhgCtOFTv4xTTn+CmoVaA5XZhhCMt2JdnmII5yXHiY3lMSGrAk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=OAcyUSjW; 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="OAcyUSjW" Received: by smtp.kernel.org (Postfix) with ESMTPSA id B0FED1F000FF; Sat, 12 Sep 2026 13:20:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1789219227; bh=HM+5jZOhf7x0py+SaSFxnkCYRwC7obu/IFqzNNl/xkA=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=OAcyUSjWEtSIMOEpwEkXtpnqFWRZTVNs5ebIpgH/aSGnBcevvC+WaHfNXwfiMQb6J tbZEaqhFr4uAFZ+4hEHrPyCLX4SwXSjCWbQqrpXep5roQ9c3T6nGIIvOjSut0ufI/N RLqcc7MwpodTm4Me4LL+oJWdPjobtTpi1VOuSYuI= 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.12 1309/1376] ASoC: dapm: Fix off-by-one check on the second enum channel Date: Sat, 12 Sep 2026 09:02:15 +0200 Message-ID: <20260912065636.707306892@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260912065607.535295758@linuxfoundation.org> References: <20260912065607.535295758@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.12-stable review patch. If anyone has any objections, please let me know. ------------------ From: HyeongJun An [ Upstream commit 14511c9b54ceeeef487409d73947c89ee8563590 ] The snd_soc_dapm_put_enum_double() rejects item[0] once it reaches e->items, but it lets item[1] be equal to it. Both go on to snd_soc_enum_item_to_val(), which indexes e->values with no bound of its own, so an enum with a value table reads one element past the end. The indexing arrived with the MUX consolidation, which relaxed the item[1] check in the same hunk. The value MUX handler it deleted used >= there, and the snd_soc_put_enum_double() in soc-ops.c still does. Only adav80x pairs a value table with two shifts, and its second channel looks accidental, but the control does report two values. Writing three into it reads off the end of adav80x_mux_values. The core catches that only under CONFIG_SND_CTL_INPUT_VALIDATION, which defaults off. Fixes: 3727b4968453 ("ASoC: dapm: Consolidate MUXs and value MUXs") Assisted-by: Claude:claude-opus-5 Signed-off-by: HyeongJun An Link: https://patch.msgid.link/20260825125745.932832-1-sammiee5311@gmail.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- sound/soc/soc-dapm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c index 196799b2fe24d..82f745628838f 100644 --- a/sound/soc/soc-dapm.c +++ b/sound/soc/soc-dapm.c @@ -3582,7 +3582,7 @@ int snd_soc_dapm_put_enum_double(struct snd_kcontrol *kcontrol, val = snd_soc_enum_item_to_val(e, item[0]) << e->shift_l; mask = e->mask << e->shift_l; if (e->shift_l != e->shift_r) { - if (item[1] > e->items) + if (item[1] >= e->items) return -EINVAL; val |= snd_soc_enum_item_to_val(e, item[1]) << e->shift_r; mask |= e->mask << e->shift_r; -- 2.53.0