aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCurtis Malainey <[email protected]>2024-02-13 14:38:34 +0200
committerMark Brown <[email protected]>2024-02-13 13:28:45 +0000
commitfcbe4873089c84da641df75cda9cac2e9addbb4b (patch)
tree6dfcfeeb97772593b50ae3362cca14f9d844c941
parentc40aad7c81e5fba34b70123ed7ce3397fa62a4d2 (diff)
ASoC: SOF: IPC3: fix message bounds on ipc ops
commit 74ad8ed65121 ("ASoC: SOF: ipc3: Implement rx_msg IPC ops") introduced a new allocation before the upper bounds check in do_rx_work. As a result A DSP can cause bad allocations if spewing garbage. Fixes: 74ad8ed65121 ("ASoC: SOF: ipc3: Implement rx_msg IPC ops") Reported-by: Tim Van Patten <[email protected]> Cc: [email protected] Signed-off-by: Curtis Malainey <[email protected]> Reviewed-by: Péter Ujfalusi <[email protected]> Reviewed-by: Daniel Baluta <[email protected]> Reviewed-by: Pierre-Louis Bossart <[email protected]> Signed-off-by: Peter Ujfalusi <[email protected]> Link: https://msgid.link/r/[email protected] Signed-off-by: Mark Brown <[email protected]>
-rw-r--r--sound/soc/sof/ipc3.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/sound/soc/sof/ipc3.c b/sound/soc/sof/ipc3.c
index fb40378ad084..c03dd513fbff 100644
--- a/sound/soc/sof/ipc3.c
+++ b/sound/soc/sof/ipc3.c
@@ -1067,7 +1067,7 @@ static void sof_ipc3_rx_msg(struct snd_sof_dev *sdev)
return;
}
- if (hdr.size < sizeof(hdr)) {
+ if (hdr.size < sizeof(hdr) || hdr.size > SOF_IPC_MSG_MAX_SIZE) {
dev_err(sdev->dev, "The received message size is invalid\n");
return;
}