--- Begin Message ---
- To: <broonie@xxxxxxxxxx>, <alsa-devel@xxxxxxxxxxxxxxxx>
- Subject: [PATCH] ASoC: SOF: amd: Fix NULL pointer crash in acp_sof_ipc_msg_data function
- From: V sujith kumar Reddy <Vsujithkumar.Reddy@xxxxxxx>
- Date: Mon, 8 May 2023 12:35:08 +0530
- Cc: Vijendar.Mukunda@xxxxxxx, Basavaraj.Hiregoudar@xxxxxxx, Sunil-kumar.Dommati@xxxxxxx, venkataprasad.potturu@xxxxxxx, ssabakar@xxxxxxx, V sujith kumar Reddy <Vsujithkumar.Reddy@xxxxxxx>, Pierre-Louis Bossart <pierre-louis.bossart@xxxxxxxxxxxxxxx>, Liam Girdwood <lgirdwood@xxxxxxxxx>, Peter Ujfalusi <peter.ujfalusi@xxxxxxxxxxxxxxx>, Bard Liao <yung-chuan.liao@xxxxxxxxxxxxxxx>, Ranjani Sridharan <ranjani.sridharan@xxxxxxxxxxxxxxx>, Kai Vehmanen <kai.vehmanen@xxxxxxxxxxxxxxx>, Daniel Baluta <daniel.baluta@xxxxxxx>, Takashi Iwai <tiwai@xxxxxxxx>, Paul Olaru <paul.olaru@xxxxxxx>, Ajit Kumar Pandey <AjitKumar.Pandey@xxxxxxx>, "moderated list:SOUND - SOUND OPEN FIRMWARE (SOF) DRIVERS" <sound-open-firmware@xxxxxxxxxxxxxxxx>, open list <linux-kernel@xxxxxxxxxxxxxxx>
Check substream and runtime variables before assigning.
Signed-off-by: V sujith kumar Reddy <Vsujithkumar.Reddy@xxxxxxx>
---
sound/soc/sof/amd/acp-ipc.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/sound/soc/sof/amd/acp-ipc.c b/sound/soc/sof/amd/acp-ipc.c
index 4e0c48a36159..749e856dc601 100644
--- a/sound/soc/sof/amd/acp-ipc.c
+++ b/sound/soc/sof/amd/acp-ipc.c
@@ -209,7 +209,12 @@ int acp_sof_ipc_msg_data(struct snd_sof_dev *sdev, struct snd_sof_pcm_stream *sp
acp_mailbox_read(sdev, offset, p, sz);
} else {
struct snd_pcm_substream *substream = sps->substream;
- struct acp_dsp_stream *stream = substream->runtime->private_data;
+ struct acp_dsp_stream *stream;
+
+ if (!substream || !substream->runtime)
+ return -ESTRPIPE;
+
+ stream = substream->runtime->private_data;
if (!stream)
return -ESTRPIPE;
--
2.25.1
--- End Message ---