Commit afdbd4cc authored by Jerry Zuo's avatar Jerry Zuo Committed by Alex Deucher
Browse files

drm/amd/display: fix NULL pointer in dm_commit_surfaces



Check if adding surface is failed to prevent NULL pointer deref.

Signed-off-by: default avatarJerry Zuo <Jerry.Zuo@amd.com>
Reviewed-by: default avatarHarry Wentland <Harry.Wentland@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent ece22899
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -2411,6 +2411,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++;
			}