From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796381979; b=H6ahAzzrusaH7n6nRIhG4+ZxdyTCRKk20CjiG0mZtCzI8GJyRgwdthE9q1Ei6OaQIIEp 9QAmjDGEyuGLIX2os+jLpgKHAjViZOE1lU78VOU0GmxzX+sfWrC4QMMD0cELOFwTOnlBP 4cM4yUZQJZhQk44dh6v4xLmdrG2bb61aYoSRNZzMsGioK5Rcag5c44Rhiagn3YDeH/WCd wRA9wfmWxvYymeRl7441F8CiXu0G6nT8ylvoYc69onUJfbr2sBAVRAcoMTrmxMhM+oGJP lA17A+T6uHoAxQN2GHWi+EUPfI2qzcBKF/TWFW0Vq8DlIRz/vNXApUVc+XFuVE0ePUw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796381979; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:User-Agent:X-stable:X-Patchwork-Hint: MIME-Version:Content-Transfer-Encoding; bh=Pkgch/3eE4GpuYHT1VSWFNf5d5+RytqsovEHMvYhvmg=; b=m1NL/2ujLbPsLiLwTUVhaPImul90i4KET3EHO2AaFCSVyokOqJrKPuTU5i+HwF/YVCLA phxPtvQwV9KPbkxmhrvU6hiN021BQR4BQDOfNVd6vBfdUmZ+9yxOSfUNDycs0MjAbG3kd ZbP15f7rgKHOpgiJ9ZaT40U2tIblpVyaWqUYP3e/EZHa7HpMBU6Oli1KyEaGVPUANJst7 UNSOUqa+qJQFOSOLlZtWQKQCqZIDYZn/mCarnMLpQS3D6BpYAyxQ7FDjGIrJUQCP3tmLq EHdGfobImVHcMqLgBL1GwJ6hg64TbaixtD+0xsDNOiGix7mdTSFAHS8EQx2kz+R/ohQ== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=Psfvx38o; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B6C61606A322; Fri, 4 Dec 2026 10:59:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=Psfvx38o Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3132D1F000C2; Fri, 4 Dec 2026 10:59:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796381979; bh=Pkgch/3eE4GpuYHT1VSWFNf5d5+RytqsovEHMvYhvmg=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=Psfvx38oP4L13Mbp+wrgSfcmBagDcEwUTWEop6ZfLWCiZSkC01lMr2OBK4szg2JUE VABmmEDvvSVvZ0rnav5EHoP+fZAmQ1quNmiObRbrmYC7VC8MEsUfFyOuyEiG6zZLXF 3wMeCE6QkHQHOasJpifsZq1u8SBLe7VbcBpUsF+g= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Arnav Kapoor , Mark Brown , Sasha Levin Subject: [PATCH 6.18 256/703] ASoC: SOF: control: reject out-of-range enum values Date: Fri, 4 Dec 2026 19:02:35 +0900 Message-ID: <20261204100634.605110107@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100627.522266145@linuxfoundation.org> References: <20261204100627.522266145@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: patches@lists.linux.dev List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: Arnav Kapoor [ Upstream commit 3092b9e481fedc413bf7acda9edc04b0bd8cb28a ] snd_sof_enum_put() passes the item indexes from user space to the IPC enum_put() op unchecked, and the IPC3 and IPC4 ops store them as they are and send them to the DSP. With the IPC4 sof-hda-generic-2ch.tplg on a Tiger Lake laptop, "Dmic0 Capture TDFB angle set enum" has 13 items but accepts 13 and 0xffffffff, and reads them back. The ALSA mixer-test selftest reports this as a write_invalid failure. Reject indexes past the last item, as snd_soc_put_enum_double() does. Fixes: c3078f539704 ("ASoC: SOF: Add Sound Open Firmware KControl support") Signed-off-by: Arnav Kapoor Link: https://patch.msgid.link/20261118103129.113970-1-kapoorarnav43@gmail.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- sound/soc/sof/control.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/sound/soc/sof/control.c b/sound/soc/sof/control.c index a3fd1d523c094..29a22af5fabc7 100644 --- a/sound/soc/sof/control.c +++ b/sound/soc/sof/control.c @@ -120,6 +120,11 @@ int snd_sof_enum_put(struct snd_kcontrol *kcontrol, struct snd_soc_component *scomp = scontrol->scomp; struct snd_sof_dev *sdev = snd_soc_component_get_drvdata(scomp); const struct sof_ipc_tplg_ops *tplg_ops = sof_ipc_get_ops(sdev, tplg); + unsigned int i; + + for (i = 0; i < scontrol->num_channels; i++) + if (ucontrol->value.enumerated.item[i] >= se->items) + return -EINVAL; if (tplg_ops && tplg_ops->control && tplg_ops->control->enum_put) return tplg_ops->control->enum_put(scontrol, ucontrol); -- 2.53.0