Commit b8f22348 authored by Allen Pan's avatar Allen Pan Committed by Alex Deucher

drm/amd/display: Add NULL-checks in dml2 assigned pipe search

[Why]
NULL-deref regression after:
"drm/amd/display: Fix dml2 assigned pipe search"

[How]
Add verification for potential NULLs

Fixes: d451b534 ("drm/amd/display: Fix dml2 assigned pipe search")
Reviewed-by: default avatarCharlene Liu <charlene.liu@amd.com>
Reviewed-by: default avatarNicholas Kazlauskas <nicholas.kazlauskas@amd.com>
Acked-by: default avatarRoman Li <roman.li@amd.com>
Signed-off-by: default avatarGabe Teeger <gabe.teeger@amd.com>
Signed-off-by: default avatarAllen Pan <allen.pan@amd.com>
Tested-by: default avatarDaniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 855f42ba
......@@ -146,19 +146,24 @@ static unsigned int find_pipes_assigned_to_plane(struct dml2_context *ctx,
for (i = 0; i < ctx->config.dcn_pipe_count; i++) {
struct pipe_ctx *pipe = &state->res_ctx.pipe_ctx[i];
if (!pipe->stream)
if (!pipe->plane_state || !pipe->stream)
continue;
get_plane_id(ctx, state, pipe->plane_state, pipe->stream->stream_id,
ctx->v20.scratch.dml_to_dc_pipe_mapping.dml_pipe_idx_to_plane_index[pipe->pipe_idx],
&plane_id_assigned_to_pipe);
if (pipe->plane_state && plane_id_assigned_to_pipe == plane_id && !pipe->top_pipe && !pipe->prev_odm_pipe) {
if (plane_id_assigned_to_pipe == plane_id && !pipe->prev_odm_pipe
&& (!pipe->top_pipe || pipe->top_pipe->plane_state != pipe->plane_state)) {
while (pipe) {
struct pipe_ctx *mpo_pipe = pipe;
while (mpo_pipe) {
pipes[num_found++] = mpo_pipe->pipe_idx;
mpo_pipe = mpo_pipe->bottom_pipe;
struct pipe_ctx *mpc_pipe = pipe;
while (mpc_pipe) {
pipes[num_found++] = mpc_pipe->pipe_idx;
mpc_pipe = mpc_pipe->bottom_pipe;
if (!mpc_pipe)
break;
if (mpc_pipe->plane_state != pipe->plane_state)
mpc_pipe = NULL;
}
pipe = pipe->next_odm_pipe;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment