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 554723B1EFC; Tue, 21 Jul 2026 20:36:57 +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=1784666218; cv=none; b=Ry0b9VKP2vWjXnTcMAELaRBI8tjG7NXFdK3RlqV3SX0GyDiztE7Qd6x0WSmUKTYVI5BaqO7Q7v0ck4RWrM5NusIzvz1yCRAO01oFiE0deT8fmGIYHj1x2zutI9X4ntSpbca4GpEhCBp466+UcTudsY9/kRuL9DAyQjLch/Gbjkw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784666218; c=relaxed/simple; bh=khTMOPK0x6f3HxmRKq3r0DodST28qZjgLfvXYu+BqWk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=m78I+iSdQ1h4S4YvnIUIP5juJ8w6FTDsO01kx7hduFU7BtAwTryYuhvLZzSIdCZSDR3jyBMosrBFsNg2gEv0JHb/HAJAnUHaMgfuvMDduLrLxdZp/xmnh0ozE0Ue4WB2jKSasmYRFplyWiUcxCUp9Z3cgeqByZh54DTXs5so04s= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=N99xxEH9; 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="N99xxEH9" Received: by smtp.kernel.org (Postfix) with ESMTPSA id B3BF51F000E9; Tue, 21 Jul 2026 20:36:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1784666217; bh=6hNd05cQ41dNy4QAadclpkSDmT2K43ztiysffa2OB0Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=N99xxEH9XcGvpSXrybYw3k5juZlTIuNMuT3U5kGztGqUN+ls+zX+LF1eyH4+Isgwi qGuyze3xa0v75Fk5KmxsUbOag3JgbCbBiRRO6GpFHnkoXR63cwr6dXhKZzVv+JYX9u X6BsEvcElJnpZIdU67EXp5cU9OcoSKc+lCzI2354= 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.6 0556/1266] ASoC: codecs: hdac_hdmi: Validate written enum value Date: Tue, 21 Jul 2026 17:16:33 +0200 Message-ID: <20260721152454.309427436@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260721152441.786066624@linuxfoundation.org> References: <20260721152441.786066624@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.6-stable review patch. If anyone has any objections, please let me know. ------------------ From: HyeongJun An [ Upstream commit 0b08baeccdcf52fad328ad645f5b4fbee04eea34 ] hdac_hdmi_set_pin_port_mux() uses the written enum value to index the texts array before calling snd_soc_dapm_put_enum_double(), which validates that the value is within the enum item range. An out-of-range value can therefore make the driver read past the texts array before the helper rejects the write. Move the lookup after the helper has accepted the value. Fixes: 4a3478debf36 ("ASoC: hdac_hdmi: Add jack reporting") Assisted-by: Claude:claude-opus-4-8 Signed-off-by: HyeongJun An Link: https://patch.msgid.link/20260609124317.38046-2-sammiee5311@gmail.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- sound/soc/codecs/hdac_hdmi.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sound/soc/codecs/hdac_hdmi.c b/sound/soc/codecs/hdac_hdmi.c index 0ddfb0cb376fde..7707f0b5562d4d 100644 --- a/sound/soc/codecs/hdac_hdmi.c +++ b/sound/soc/codecs/hdac_hdmi.c @@ -906,12 +906,14 @@ static int hdac_hdmi_set_pin_port_mux(struct snd_kcontrol *kcontrol, struct hdac_device *hdev = dev_to_hdac_dev(dapm->dev); struct hdac_hdmi_priv *hdmi = hdev_to_hdmi_priv(hdev); struct hdac_hdmi_pcm *pcm; - const char *cvt_name = e->texts[ucontrol->value.enumerated.item[0]]; + const char *cvt_name; ret = snd_soc_dapm_put_enum_double(kcontrol, ucontrol); if (ret < 0) return ret; + cvt_name = e->texts[ucontrol->value.enumerated.item[0]]; + if (port == NULL) return -EINVAL; -- 2.53.0