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 2130234FF78; Sat, 12 Sep 2026 09:26:48 +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=1789205210; cv=none; b=L4d3P9Z6M7XiSOPgZOy5FmQtKTRE3fuOn1QJX+1ROii6ifpOLxzpVQMaY8Cjgr2uEKqHuKrqjGLka7hpDYKq7KBHfRVKJvBx2P9clXRYw3fKeyYOGk+Sko70Jfe4fDTu7BO8hFmerz/87zuN08sTV1pWqApGuFYWZb3e+h5Z0Ww= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789205210; c=relaxed/simple; bh=MMx/+zaH7UYoCejx0FK4oEwvammJbPQ9eIOGUUUV3vs=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=gUySvprr4K9a2t94b+0x+dd43e58jTnFC80OHvK4ckxQuaEM0jhyE7ztpu+PacwNJkQJKRUxebzLWSNuKAhoYjFZntSeHHOVCKa2XFtQIHS2WoE8kPMwVuorf1exzTuhqban59Ks1Y5/6HrqkJTnMeZvuCrDoMGuFLtt0DcGFpk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=WP4SfJZD; 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="WP4SfJZD" Received: by smtp.kernel.org (Postfix) with ESMTPSA id D65831F000FF; Sat, 12 Sep 2026 09:26:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1789205208; bh=sxgKBK0F2Oh+mhUOg5WmNp/URUbZskL9/LPn9e1xO/w=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=WP4SfJZD5lyihCgbvoWuDzw/jyI1gjewLMZrASS/u8TZLLgrNunYh+ffawVhV7j5G 7QjqPsM+IZm4Ci63pQR9sYI+uOw5j7h8xJoDbTIen8Z8jkde6620av/+JuPP+kye6c psF6Gk0l6FsU4Ikmv6ZN/uMQI8mFMJxLVj4zzylg= 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 7.2 1770/1815] ASoC: dapm: Fix off-by-one check on the second enum channel Date: Sat, 12 Sep 2026 08:58:40 +0200 Message-ID: <20260912065730.558422783@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260912065648.999753832@linuxfoundation.org> References: <20260912065648.999753832@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 7.2-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 4ad126bd4f705..646f26b7b4153 100644 --- a/sound/soc/soc-dapm.c +++ b/sound/soc/soc-dapm.c @@ -3608,7 +3608,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