Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f5ba60fe authored by Drew Davenport's avatar Drew Davenport Committed by Alex Deucher
Browse files

amdgpu/dc: Avoid dereferencing NULL pointer



crtc is dereferenced from within drm_atomic_get_new_crtc_state, so
check for NULL before initializing new_crtc_state.

Signed-off-by: default avatarDrew Davenport <ddavenport@chromium.org>
Reviewed-by: default avatarHarry Wentland <harry.wentland@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 30b7c614
Loading
Loading
Loading
Loading
+6 −3
Original line number Original line Diff line number Diff line
@@ -3853,8 +3853,7 @@ static void amdgpu_dm_commit_planes(struct drm_atomic_state *state,
	/* update planes when needed */
	/* update planes when needed */
	for_each_oldnew_plane_in_state(state, plane, old_plane_state, new_plane_state, i) {
	for_each_oldnew_plane_in_state(state, plane, old_plane_state, new_plane_state, i) {
		struct drm_crtc *crtc = new_plane_state->crtc;
		struct drm_crtc *crtc = new_plane_state->crtc;
		struct drm_crtc_state *new_crtc_state =
		struct drm_crtc_state *new_crtc_state;
				drm_atomic_get_new_crtc_state(state, crtc);
		struct drm_framebuffer *fb = new_plane_state->fb;
		struct drm_framebuffer *fb = new_plane_state->fb;
		bool pflip_needed;
		bool pflip_needed;
		struct dm_plane_state *dm_new_plane_state = to_dm_plane_state(new_plane_state);
		struct dm_plane_state *dm_new_plane_state = to_dm_plane_state(new_plane_state);
@@ -3864,7 +3863,11 @@ static void amdgpu_dm_commit_planes(struct drm_atomic_state *state,
			continue;
			continue;
		}
		}


		if (!fb || !crtc || pcrtc != crtc || !new_crtc_state->active)
		if (!fb || !crtc || pcrtc != crtc)
			continue;

		new_crtc_state = drm_atomic_get_new_crtc_state(state, crtc);
		if (!new_crtc_state->active)
			continue;
			continue;


		pflip_needed = !state->allow_modeset;
		pflip_needed = !state->allow_modeset;