Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions sound/soc/sof/ipc3-control.c
Original file line number Diff line number Diff line change
Expand Up @@ -380,6 +380,7 @@ static int sof_ipc3_bytes_ext_put(struct snd_sof_control *scontrol,
struct sof_ipc_ctrl_data *cdata = scontrol->ipc_control_data;
struct snd_soc_component *scomp = scontrol->scomp;
struct snd_ctl_tlv header;
unsigned int payload;
int ret = -EINVAL;

/*
Expand Down Expand Up @@ -449,6 +450,15 @@ static int sof_ipc3_bytes_ext_put(struct snd_sof_control *scontrol,
goto err_restore;
}

/* header.length has been verified to be >= sizeof(struct sof_abi_hdr) */
payload = header.length - sizeof(struct sof_abi_hdr);
if (cdata->data->size > payload) {
dev_err_ratelimited(scomp->dev,
"ABI header claims %u bytes of data, TLV carries %u\n",
cdata->data->size, payload);
goto err_restore;
}

/* notify DSP of byte control updates */
if (pm_runtime_active(scomp->dev)) {
/* Actually send the data to the DSP; this is an opportunity to validate the data */
Expand Down
Loading