Skip to content

Commit 6aed8fb

Browse files
lrgirdwokv2019i
authored andcommitted
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 0068678 commit 6aed8fb

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
@@ -286,8 +286,10 @@ static int volume_set_attenuation(struct processing_module *mod, const uint8_t *
286286
struct comp_dev *dev = mod->dev;
287287
uint32_t attenuation;
288288

289-
/* only support attenuation in format of 32bit */
290-
if (data_size > sizeof(uint32_t)) {
289+
/* only support attenuation in format of 32bit; the payload is
290+
* dereferenced as a uint32_t below so it must be exactly that size
291+
*/
292+
if (data_size != (int)sizeof(uint32_t)) {
291293
comp_err(dev, "attenuation data size %d is incorrect", data_size);
292294
return -EINVAL;
293295
}

0 commit comments

Comments
 (0)