Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ipc3: handler: Add check for pipeline->source_comp being NULL #9586

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions src/ipc/ipc3/handler.c
Original file line number Diff line number Diff line change
Expand Up @@ -386,6 +386,13 @@ static int ipc_stream_pcm_free(uint32_t header)
return -EINVAL;
}

/* pipeline_reset() crashes if source_comp is NULL */
if (!pcm_dev->cd->pipeline->source_comp) {
ipc_cmd_err(&ipc_tr, "ipc: comp %d source comp not found",
free_req.comp_id);
return -EINVAL;
}

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we have the check in pipeline_comp_reset() and make pipeline_reset() safe against condition of partially set up pipeline (with source_comp as NULL). This would fix a much larger set of cases (including IPC4) against this possibility.

Copy link
Contributor Author

@jsarha jsarha Oct 17, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kv2019i , sure. There just is no evidence that IPC4 would suffer from this kind of problem. But if you think that is better approach, then I can send my first fix. I decided against it and came up with this version, since I tried to avoid affecting IPC4-code, as the problem was found from IPC3.

/* reset the pipeline */
ret = pipeline_reset(pcm_dev->cd->pipeline, pcm_dev->cd);

Expand Down
Loading