Skip to content

Commit 2078f8b

Browse files
committed
volume: validate init payload covers per-channel config
Init read a per-channel config array sized by the channel count from the init payload without checking the payload was large enough, reading past the mailbox. Require the payload to cover the base config and all per-channel entries. Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
1 parent 31590ac commit 2078f8b

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

src/audio/volume/volume_ipc4.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,15 @@ int volume_init(struct processing_module *mod)
127127
return -EINVAL;
128128
}
129129

130+
/* the per-channel config[] array is read below for every channel, so
131+
* the init payload must be large enough to hold them all
132+
*/
133+
if (cfg->size < sizeof(*vol) + channels_count * sizeof(vol->config[0])) {
134+
comp_err(dev, "Invalid init payload size %zu for %u channels",
135+
cfg->size, channels_count);
136+
return -EINVAL;
137+
}
138+
130139
cd = mod_zalloc(mod, sizeof(struct vol_data));
131140
if (!cd)
132141
return -ENOMEM;

0 commit comments

Comments
 (0)