Commit fcbe4873 authored by Curtis Malainey's avatar Curtis Malainey Committed by Mark Brown

ASoC: SOF: IPC3: fix message bounds on ipc ops

commit 74ad8ed6 ("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: 74ad8ed6 ("ASoC: SOF: ipc3: Implement rx_msg IPC ops")
Reported-by: default avatarTim Van Patten <timvp@google.com>
Cc: stable@vger.kernel.org
Signed-off-by: default avatarCurtis Malainey <cujomalainey@chromium.org>
Reviewed-by: default avatarPéter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: default avatarDaniel Baluta <daniel.baluta@nxp.com>
Reviewed-by: default avatarPierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: default avatarPeter Ujfalusi <peter.ujfalusi@linux.intel.com>
Link: https://msgid.link/r/20240213123834.4827-1-peter.ujfalusi@linux.intel.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent c40aad7c
...@@ -1067,7 +1067,7 @@ static void sof_ipc3_rx_msg(struct snd_sof_dev *sdev) ...@@ -1067,7 +1067,7 @@ static void sof_ipc3_rx_msg(struct snd_sof_dev *sdev)
return; 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"); dev_err(sdev->dev, "The received message size is invalid\n");
return; return;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment