From: Jerry Zuo <Jerry.Zuo@xxxxxxx> Check if adding surface is failed to prevent NULL pointer deref. Change-Id: I804585bf126e74570875f4b8508358d3bad172a0 Signed-off-by: Jerry Zuo <Jerry.Zuo at amd.com> Reviewed-by: Harry Wentland <Harry.Wentland at amd.com> --- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_types.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_types.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_types.c index 15204bf7d9a8..543acb712edf 100644 --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_types.c +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_types.c @@ -2590,6 +2590,10 @@ static void amdgpu_dm_commit_surfaces(struct drm_atomic_state *state, if (crtc == pcrtc) { add_surface(dm->dc, crtc, plane, &dc_surfaces_constructed[planes_count]); + if (dc_surfaces_constructed[planes_count] == NULL) { + dm_error("%s: Failed to add surface!\n", __func__); + continue; + } dc_stream_attach = acrtc_attach->stream; planes_count++; } -- 2.11.0