Skip to content

Commit 989a3e4

Browse files
ujfalusibroonie
authored andcommitted
ASoC: SOF: ipc3: Check for upper size limit for the received message
The sof_ipc3_rx_msg() checks for minimum size of a new rx message but it is missing the check for upper limit. Corrupted or compromised firmware might be able to take advantage of this to cause out of bounds reads outside of the message area. Reported-by: Curtis Malainey <[email protected]> Signed-off-by: Peter Ujfalusi <[email protected]> Reviewed-by: Pierre-Louis Bossart <[email protected]> Reviewed-by: Curtis Malainey <[email protected]> Signed-off-by: Peter Ujfalusi <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mark Brown <[email protected]>
1 parent 38d408f commit 989a3e4

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

sound/soc/sof/ipc3.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -970,8 +970,9 @@ static void sof_ipc3_rx_msg(struct snd_sof_dev *sdev)
970970
return;
971971
}
972972

973-
if (hdr.size < sizeof(hdr)) {
974-
dev_err(sdev->dev, "The received message size is invalid\n");
973+
if (hdr.size < sizeof(hdr) || hdr.size > SOF_IPC_MSG_MAX_SIZE) {
974+
dev_err(sdev->dev, "The received message size is invalid: %u\n",
975+
hdr.size);
975976
return;
976977
}
977978

0 commit comments

Comments
 (0)