From eaf8fd0803c684ec78371428aee87f7636fd59e6 Mon Sep 17 00:00:00 2001 From: Bard Liao Date: Thu, 7 Sep 2023 10:38:31 +0800 Subject: [PATCH] ASoC: SOF: ipc4: check return value snd_sof_ipc_msg_data could return error. Signed-off-by: Bard Liao --- sound/soc/sof/ipc4.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/sound/soc/sof/ipc4.c b/sound/soc/sof/ipc4.c index fa7a30d09e8bb2..ac5c6bc66d2ab7 100644 --- a/sound/soc/sof/ipc4.c +++ b/sound/soc/sof/ipc4.c @@ -685,7 +685,14 @@ static void sof_ipc4_rx_msg(struct snd_sof_dev *sdev) return; ipc4_msg->data_size = data_size; - snd_sof_ipc_msg_data(sdev, NULL, ipc4_msg->data_ptr, ipc4_msg->data_size); + err = snd_sof_ipc_msg_data(sdev, NULL, ipc4_msg->data_ptr, ipc4_msg->data_size); + if (err < 0) { + dev_err(sdev->dev, "failed to read IPC notification data: %d\n", err); + kfree(ipc4_msg->data_ptr); + ipc4_msg->data_ptr = NULL; + ipc4_msg->data_size = 0; + return; + } } /* Handle notifications with payload */