-
Notifications
You must be signed in to change notification settings - Fork 361
copier: validate host-supplied gateway config and queue indices #10908
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
e75b60f
02eca4b
957cc9f
cf12086
971fc96
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -88,6 +88,16 @@ static int copier_alh_assign_dai_index(struct comp_dev *dev, | |
| switch (dai->type) { | ||
| case SOF_DAI_INTEL_HDA: | ||
| /* We use DAI_INTEL_HDA for ACE 2.0 platforms */ | ||
| /* | ||
| * alh_cfg.count is host-controlled and scales the config size | ||
| * and mapping[] walk below; bound it before any arithmetic so a | ||
| * crafted blob cannot read past the gateway config. | ||
| */ | ||
| if (alh_blob->alh_cfg.count > IPC4_ALH_MAX_NUMBER_OF_GTW) { | ||
| comp_err(mod->dev, "Invalid ALH count: %u", | ||
| alh_blob->alh_cfg.count); | ||
| return -EINVAL; | ||
| } | ||
|
Comment on lines
+96
to
+100
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| alh_cfg_size = get_alh_config_size(alh_blob); | ||
| dma_config = (uint8_t *)gtw_cfg_data + alh_cfg_size; | ||
| dma_config_length = (cd->config.gtw_cfg.config_length << 2) - alh_cfg_size; | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -330,6 +330,12 @@ void copier_update_params(struct copier_data *cd, struct comp_dev *dev, | |
| int j; | ||
| j = IPC4_SRC_QUEUE_ID(buf_get_id(sink)); | ||
|
|
||
| /* src_queue id is host-controlled; bound it before indexing out_fmt[] */ | ||
| if (j >= IPC4_COPIER_MODULE_OUTPUT_PINS_COUNT) { | ||
| comp_err(dev, "invalid src_queue id %d", j); | ||
| continue; | ||
| } | ||
|
|
||
| ipc4_update_buffer_format(sink, &cd->out_fmt[j]); | ||
|
Comment on lines
330
to
339
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| } | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed — changed the format specifier to
%u(data_offsetisuint32_t).