]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
ASoC: SOF: ipc4-topology: Allow bytes controls without initial payload
authorPeter Ujfalusi <peter.ujfalusi@linux.intel.com>
Thu, 26 Mar 2026 07:56:18 +0000 (09:56 +0200)
committerMark Brown <broonie@kernel.org>
Thu, 26 Mar 2026 11:16:03 +0000 (11:16 +0000)
It is unexpected, but allowed to have no initial payload for a bytes
control and the code is prepared to handle this case, but the size check
missed this corner case.

Update the check for minimal size to allow the initial size to be 0.

Cc: stable@vger.kernel.org
Fixes: a653820700b8 ("ASoC: SOF: ipc4-topology: Correct the allocation size for bytes controls")
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: Liam Girdwood <liam.r.girdwood@intel.com>
Reviewed-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Link: https://patch.msgid.link/20260326075618.1603-1-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/sof/ipc4-topology.c

index db077e9d56445ae8d65abaa3e8b1db16a03ad6b1..c12ffdcfe4e3b8a026b3c27c3611a32645d58800 100644 (file)
@@ -2950,7 +2950,7 @@ static int sof_ipc4_control_load_bytes(struct snd_sof_dev *sdev, struct snd_sof_
                return -EINVAL;
        }
 
-       if (scontrol->priv_size < sizeof(struct sof_abi_hdr)) {
+       if (scontrol->priv_size && 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);