Skip to content

Commit 4d14b10

Browse files
ujfalusibroonie
authored andcommitted
ASoC: SOF: ipc4-control: Use SOF_CTRL_CMD_BINARY as numid for bytes_ext
The header.numid is set to scontrol->comp_id in bytes_ext_get and it is ignored during bytes_ext_put. The use of comp_id is not quite great as it is kernel internal identification number. Set the header.numid to SOF_CTRL_CMD_BINARY during get and validate the numid during put to provide consistent and compatible identification number as IPC3. For IPC4 existing tooling also ignored the numid but with the use of SOF_CTRL_CMD_BINARY the different handling of the blobs can be dropped, providing better user experience. Reported-by: Seppo Ingalsuo <[email protected]> Closes: thesofproject#5282 Fixes: a062c88 ("ASoC: SOF: ipc4-control: Add support for bytes control get and put") Cc: [email protected] Signed-off-by: Peter Ujfalusi <[email protected]> Reviewed-by: Seppo Ingalsuo <[email protected]> Reviewed-by: Ranjani Sridharan <[email protected]> Reviewed-by: Liam Girdwood <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Mark Brown <[email protected]>
1 parent b7e3ec4 commit 4d14b10

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

sound/soc/sof/ipc4-control.c

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -531,6 +531,14 @@ static int sof_ipc4_bytes_ext_put(struct snd_sof_control *scontrol,
531531
return -EINVAL;
532532
}
533533

534+
/* Check header id */
535+
if (header.numid != SOF_CTRL_CMD_BINARY) {
536+
dev_err_ratelimited(scomp->dev,
537+
"Incorrect numid for bytes put %d\n",
538+
header.numid);
539+
return -EINVAL;
540+
}
541+
534542
/* Verify the ABI header first */
535543
if (copy_from_user(&abi_hdr, tlvd->tlv, sizeof(abi_hdr)))
536544
return -EFAULT;
@@ -613,7 +621,8 @@ static int _sof_ipc4_bytes_ext_get(struct snd_sof_control *scontrol,
613621
if (data_size > size)
614622
return -ENOSPC;
615623

616-
header.numid = scontrol->comp_id;
624+
/* Set header id and length */
625+
header.numid = SOF_CTRL_CMD_BINARY;
617626
header.length = data_size;
618627

619628
if (copy_to_user(tlvd, &header, sizeof(struct snd_ctl_tlv)))

0 commit comments

Comments
 (0)