ipc3: Check component type in ipc_stream_pcm_params()

This handler was missing its type check and would follow comp_dev
union fields on components that might be buffers or pipelines, leading
to crashes downstream.

Found via fuzzing.

Signed-off-by: Andy Ross <andyross@google.com>
This commit is contained in:
Andy Ross 2023-06-06 08:11:18 -07:00 committed by Michal Wasko
parent 403c33f829
commit 65dc05a131
1 changed files with 6 additions and 0 deletions

View File

@ -222,6 +222,12 @@ static int ipc_stream_pcm_params(uint32_t stream)
return -ENODEV; return -ENODEV;
} }
if (pcm_dev->type != COMP_TYPE_COMPONENT) {
tr_err(&ipc_tr, "ipc_stream_pcm_params(): pcm_dev id %d not component (type %d)",
pcm_dev->id, pcm_dev->type);
return -EINVAL;
}
/* check core */ /* check core */
if (!cpu_is_me(pcm_dev->core)) if (!cpu_is_me(pcm_dev->core))
return ipc_process_on_core(pcm_dev->core, false); return ipc_process_on_core(pcm_dev->core, false);