Skip to content

Commit 4764a4f

Browse files
lrgirdwokv2019i
authored andcommitted
copier: 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 payload shorter than that read past the mailbox. Require exactly a 32-bit payload. Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
1 parent 249cf37 commit 4764a4f

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

src/audio/copier/copier.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -797,9 +797,11 @@ __cold static int set_attenuation(struct comp_dev *dev, uint32_t data_offset, co
797797

798798
assert_can_be_cold();
799799

800-
/* only support attenuation in format of 32bit */
801-
if (data_offset > sizeof(uint32_t)) {
802-
comp_err(dev, "attenuation data size %d is incorrect", data_offset);
800+
/* only support attenuation in format of 32bit; the payload is
801+
* dereferenced as a uint32_t below so it must be exactly that size
802+
*/
803+
if (data_offset != sizeof(uint32_t)) {
804+
comp_err(dev, "attenuation data size %u is incorrect", data_offset);
803805
return -EINVAL;
804806
}
805807

0 commit comments

Comments
 (0)