Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 682B91ADFE4; Sun, 1 Mar 2026 01:30:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772328620; cv=none; b=QTl2gPzbEq51NRRcHUUOdNm88abu8TbOaML76ygZwpzk+gRtDTYCwMWR0SYnH0gwyZbPjX5ZJcbA6PDznMutY64JwonXHyWUIXxtqf2CTe71I7cQM1o7RhNpDDZxgoB9wEPkzWGjc7wMf2Il1wr3WXd7kMUeOWR0+zRBg+f2x0g= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772328620; c=relaxed/simple; bh=lUyqfoeZ/RcnremLn+Ua7NUWSV0Lh/CAzvePVnGiGa8=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=n1ilQA6ZxvG2h3zkU3OyMqxPMsjNhOLH8aWRduXuFTnQKzF277K8xT7QOJjufQmoWp9Fm/gGBk9uuqFrFMe6i/SP1PseJw9+5dxZmbb50Sc+lA7gvzAEPRuVcDZwbMgfMq4aokL+VXJ6RN+LUhGBq5ANiYagOHoOZMjp7K8NtYc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=od2+3s0G; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="od2+3s0G" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5E7ADC19421; Sun, 1 Mar 2026 01:30:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1772328620; bh=lUyqfoeZ/RcnremLn+Ua7NUWSV0Lh/CAzvePVnGiGa8=; h=From:To:Cc:Subject:Date:From; b=od2+3s0G4+BtpiOs8hSt8nCD0k25EHfVCaQqga8vK98J3MeRNxHWfY+xK3dVKMxSC mgD0JDR1TwFH1GJ/HG0uefCVBRMO1fnPp8bWogKHjL0xEYfLbh5BeFszDuOwH13Rz1 oBfoa1CBG5O8fJPGKd8W4Eb9oKiiL9aJml861Pig2hXSTk94CdaKZHY2IXlk+I2lnV 8Y+X/7jnQuzRT3YpXh6ZdZ6o687wqTagPSHAV6X8oo1O+HBMmaGR0Ezr1RVlbWnuIc onuBvfNoR6s6FdDvVJSpGDGgJgZzvIN736pZOoWhbRVnLZG9UXa4URI3f9opEhXnJv J1FP9cY+Tcdmg== From: Sasha Levin To: stable@vger.kernel.org, peter.ujfalusi@linux.intel.com Cc: Seppo Ingalsuo , Ranjani Sridharan , Bard Liao , Kai Vehmanen , Mark Brown , sound-open-firmware@alsa-project.org, linux-sound@vger.kernel.org Subject: FAILED: Patch "ASoC: SOF: ipc4-topology: Correct the allocation size for bytes controls" failed to apply to 6.6-stable tree Date: Sat, 28 Feb 2026 20:30:17 -0500 Message-ID: <20260301013018.1688391-1-sashal@kernel.org> X-Mailer: git-send-email 2.51.0 Precedence: bulk X-Mailing-List: linux-sound@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Hint: ignore X-stable: review Content-Transfer-Encoding: 8bit The patch below does not apply to the 6.6-stable tree. If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to . Thanks, Sasha ------------------ original commit in Linus's tree ------------------ From a653820700b81c9e6f05ac23b7969ecec1a18e85 Mon Sep 17 00:00:00 2001 From: Peter Ujfalusi Date: Wed, 17 Dec 2025 16:39:39 +0200 Subject: [PATCH] ASoC: SOF: ipc4-topology: Correct the allocation size for bytes controls The size of the data behind of scontrol->ipc_control_data for bytes controls is: [1] sizeof(struct sof_ipc4_control_data) + // kernel only struct [2] sizeof(struct sof_abi_hdr)) + payload The max_size specifies the size of [2] and it is coming from topology. Change the function to take this into account and allocate adequate amount of memory behind scontrol->ipc_control_data. With the change we will allocate [1] amount more memory to be able to hold the full size of data. Fixes: a382082ff74b ("ASoC: SOF: ipc4-topology: Add support for TPLG_CTL_BYTES") Cc: stable@vger.kernel.org Signed-off-by: Peter Ujfalusi Reviewed-by: Seppo Ingalsuo Reviewed-by: Ranjani Sridharan Reviewed-by: Bard Liao Reviewed-by: Kai Vehmanen Link: https://patch.msgid.link/20251217143945.2667-3-peter.ujfalusi@linux.intel.com Signed-off-by: Mark Brown --- sound/soc/sof/ipc4-topology.c | 35 +++++++++++++++++++++++++++-------- 1 file changed, 27 insertions(+), 8 deletions(-) diff --git a/sound/soc/sof/ipc4-topology.c b/sound/soc/sof/ipc4-topology.c index 221e9d4052b8f..4272d84679ac1 100644 --- a/sound/soc/sof/ipc4-topology.c +++ b/sound/soc/sof/ipc4-topology.c @@ -2855,22 +2855,41 @@ static int sof_ipc4_control_load_bytes(struct snd_sof_dev *sdev, struct snd_sof_ struct sof_ipc4_msg *msg; int ret; - if (scontrol->max_size < (sizeof(*control_data) + sizeof(struct sof_abi_hdr))) { - dev_err(sdev->dev, "insufficient size for a bytes control %s: %zu.\n", + /* + * The max_size is coming from topology and indicates the maximum size + * of sof_abi_hdr plus the payload, which excludes the local only + * 'struct sof_ipc4_control_data' + */ + if (scontrol->max_size < sizeof(struct sof_abi_hdr)) { + dev_err(sdev->dev, + "insufficient maximum size for a bytes control %s: %zu.\n", scontrol->name, scontrol->max_size); return -EINVAL; } - if (scontrol->priv_size > scontrol->max_size - sizeof(*control_data)) { - dev_err(sdev->dev, "scontrol %s bytes data size %zu exceeds max %zu.\n", - scontrol->name, scontrol->priv_size, - scontrol->max_size - sizeof(*control_data)); + if (scontrol->priv_size > scontrol->max_size) { + dev_err(sdev->dev, + "bytes control %s initial data size %zu exceeds max %zu.\n", + scontrol->name, scontrol->priv_size, scontrol->max_size); + return -EINVAL; + } + + if (scontrol->priv_size < sizeof(struct sof_abi_hdr)) { + dev_err(sdev->dev, + "bytes control %s initial data size %zu is insufficient.\n", + scontrol->name, scontrol->priv_size); return -EINVAL; } - scontrol->size = sizeof(struct sof_ipc4_control_data) + scontrol->priv_size; + /* + * The used size behind the cdata pointer, which can be smaller than + * the maximum size + */ + scontrol->size = sizeof(*control_data) + scontrol->priv_size; - scontrol->ipc_control_data = kzalloc(scontrol->max_size, GFP_KERNEL); + /* Allocate the cdata: local struct size + maximum payload size */ + scontrol->ipc_control_data = kzalloc(sizeof(*control_data) + scontrol->max_size, + GFP_KERNEL); if (!scontrol->ipc_control_data) return -ENOMEM; -- 2.51.0