Skip to content

Commit 24e5f5e

Browse files
committed
volume: require a full word for the attenuation control
The attenuation setter only rejected oversized payloads, then dereferenced the data as a 32-bit value; a shorter payload read past the mailbox. Require exactly a 32-bit payload. Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
1 parent 2078f8b commit 24e5f5e

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

src/audio/volume/volume_ipc4.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -277,8 +277,10 @@ static int volume_set_attenuation(struct processing_module *mod, const uint8_t *
277277
struct comp_dev *dev = mod->dev;
278278
uint32_t attenuation;
279279

280-
/* only support attenuation in format of 32bit */
281-
if (data_size > sizeof(uint32_t)) {
280+
/* only support attenuation in format of 32bit; the payload is
281+
* dereferenced as a uint32_t below so it must be exactly that size
282+
*/
283+
if (data_size != (int)sizeof(uint32_t)) {
282284
comp_err(dev, "attenuation data size %d is incorrect", data_size);
283285
return -EINVAL;
284286
}

0 commit comments

Comments
 (0)