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=1796380317; b=YQgMe+fOOObCH6RFOKo0wnePd817ikJIkJlA3EWTi+RH5RQnoOC/OzXDFhiemJuaq59/ S6k5izghuvSDwg9gwzjfYT61y0va2zy7dRuwAXIeU4EjNu+Vl70qjqUiv29awLlMCAZ6F iEXpzF/a6M4EQu3OegeElg5i5D5beH2afmnFPbFhxMsG2BJC/GyKAHkpWv+SoPXHix/4u F0Kfg4wfmYu5tXoKugFhHTZIL9Mu//WrNFlX0H3fVl92eck2tZ17pTh/srpnQrmgA8PmH ympzEbdli2jBcxXNSYZBf5mRhfEbHGI7BucMGVEVHE4H49W/Z89jXhvSo2Ew41AikVA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796380317; 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=G+sYd2+xSYJ66cw4tEeFeSsAEPBEzE6AwZiuC8IIOic=; b=TgvBRa23XyzatiX0WNn76tVMTDLdi4i2UMWozw7NF7JBkjh5agXKH2pkR7mLmgsjdUkE AZOCBxJs+ulHmh0MeJqeWJyt3gqedFpUM8HLPx730yHFxn8VMK8ThQZJghPC1PJbYWFQ2 S3qcwPpArwK52+Vfs4y3lQoPRj+Ur604Cy1la6T7Sbi2026EY4F8Fw6ua1RQPqDcb9Qiv lK0JZBxfLZmPFeTA96LiQFKtpoV4CIuv1naQ5jVhVd7t1apLrB4vQ+56vQQOatEMSVfwY +vSNANxZsT9RnZNXF9ufsfmwWkl8c78G0T3mMvApGliqzPk8uFxD5yeSvca24n8MktA== 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=TdxmNxHy; 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 8C6DB606A330; Fri, 4 Dec 2026 10:31:57 +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=TdxmNxHy Received: by smtp.kernel.org (Postfix) with ESMTPSA id C67C31F00931; Fri, 4 Dec 2026 10:31:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796380317; bh=G+sYd2+xSYJ66cw4tEeFeSsAEPBEzE6AwZiuC8IIOic=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=TdxmNxHy0lULLSDc/Na34RBfgmG2cr0yv6qsH8iIf2S9H857/U2y4/v4pURRv4m6X ISVWUJ1LxOIvTiN/NJ4+OztRyCG214mgbm5R1xf1hZ9bb6frto9tMteBzQPZ6tAtMc wqf6hVSEjdcxZgUvyI0JbAyhV9w7FJtcTMCUJyvY= 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 7.3 219/742] ASoC: SOF: control: reject out-of-range enum values Date: Fri, 4 Dec 2026 19:01:23 +0900 Message-ID: <20261204100640.894155002@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100635.034361255@linuxfoundation.org> References: <20261204100635.034361255@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 7.3-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 74d997a4f6203..625a17624f415 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