Skip to content

Commit d8d99c3

Browse files
ujfalusibroonie
authored andcommitted
ASoC: SOF: stream-ipc: Check for cstream nullity in sof_ipc_msg_data()
The nullity of sps->cstream should be checked similarly as it is done in sof_set_stream_data_offset() function. Assuming that it is not NULL if sps->stream is NULL is incorrect and can lead to NULL pointer dereference. Fixes: 090349a ("ASoC: SOF: Add support for compress API for stream data/offset") Cc: stable@vger.kernel.org Reported-by: Curtis Malainey <cujomalainey@chromium.org> Closes: thesofproject#5214 Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com> Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com> Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com> Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com> Reviewed-by: Curtis Malainey <cujomalainey@chromium.org> Link: https://patch.msgid.link/20250205135232.19762-2-peter.ujfalusi@linux.intel.com Signed-off-by: Mark Brown <broonie@kernel.org>
1 parent 98fcb50 commit d8d99c3

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

sound/soc/sof/stream-ipc.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,14 +43,18 @@ int sof_ipc_msg_data(struct snd_sof_dev *sdev,
4343
return -ESTRPIPE;
4444

4545
posn_offset = stream->posn_offset;
46-
} else {
46+
} else if (sps->cstream) {
4747

4848
struct sof_compr_stream *sstream = sps->cstream->runtime->private_data;
4949

5050
if (!sstream)
5151
return -ESTRPIPE;
5252

5353
posn_offset = sstream->posn_offset;
54+
55+
} else {
56+
dev_err(sdev->dev, "%s: No stream opened\n", __func__);
57+
return -EINVAL;
5458
}
5559

5660
snd_sof_dsp_mailbox_read(sdev, posn_offset, p, sz);

0 commit comments

Comments
 (0)