[Sound-open-firmware] [PATCH] Component ABI: Check for valid ABI header for COMP_CMD_SET_DATA command
This patch adds the code to check the generic ABI header fields and reject data with invalid header. The individual components those use ABI need to check the component specific fields in addition.
Signed-off-by: Seppo Ingalsuo seppo.ingalsuo@linux.intel.com --- src/include/reef/audio/component.h | 11 +++++++++++ 1 file changed, 11 insertions(+)
diff --git a/src/include/reef/audio/component.h b/src/include/reef/audio/component.h index 5ae8084..436a758 100644 --- a/src/include/reef/audio/component.h +++ b/src/include/reef/audio/component.h @@ -245,6 +245,17 @@ static inline int comp_host_buffer(struct comp_dev *dev, /* send component command - mandatory */ static inline int comp_cmd(struct comp_dev *dev, int cmd, void *data) { + struct sof_ipc_ctrl_data *cdata = data; + + if ((cmd == COMP_CMD_SET_DATA) + && ((cdata->data->magic != SOF_ABI_MAGIC) + || (cdata->data->abi != SOF_ABI_VERSION))) { + trace_comp_error("abi"); + trace_value(cdata->data->magic); + trace_value(cdata->data->abi); + return -EINVAL; + } + return dev->drv->ops.cmd(dev, cmd, data); }
participants (1)
-
Seppo Ingalsuo