mirror of https://github.com/thesofproject/sof.git
ipc: check pipeline validity
We have some commands that fail to check the component's pipeline pointer before running the command which results in various null pointer dereferences across the codebase. Solution is to copy existing checks and patch the code paths. Signed-off-by: Curtis Malainey <cujomalainey@chromium.org>
This commit is contained in:
parent
8357dcf793
commit
ab7961ccbc
|
@ -379,6 +379,12 @@ static int ipc_stream_position(uint32_t header)
|
|||
posn.rhdr.hdr.size = sizeof(posn);
|
||||
posn.comp_id = stream.comp_id;
|
||||
|
||||
if (!pcm_dev->cd->pipeline) {
|
||||
tr_err(&ipc_tr, "ipc: comp %d pipeline not found",
|
||||
stream.comp_id);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
/* get the stream positions and timestamps */
|
||||
pipeline_get_timestamp(pcm_dev->cd->pipeline, pcm_dev->cd, &posn);
|
||||
|
||||
|
@ -436,6 +442,12 @@ static int ipc_stream_trigger(uint32_t header)
|
|||
return -ENODEV;
|
||||
}
|
||||
|
||||
if (!pcm_dev->cd->pipeline) {
|
||||
tr_err(&ipc_tr, "ipc: comp %d pipeline not found",
|
||||
stream.comp_id);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
/* trigger the component */
|
||||
ret = pipeline_trigger(pcm_dev->cd->pipeline, pcm_dev->cd, cmd);
|
||||
if (ret < 0) {
|
||||
|
|
Loading…
Reference in New Issue