diff options
author | Drew Davenport <ddavenport@chromium.org> | 2017-10-27 14:34:46 -0400 |
---|---|---|
committer | Alex Deucher <alexander.deucher@amd.com> | 2017-11-02 12:58:41 -0400 |
commit | f5ba60fefa00ca789c4eb35df38b171d532b3155 (patch) | |
tree | b2a1190330d9a4ecfd21cee02ad8dfcdaf1013c4 | |
parent | 30b7c6147d18d77c6120a8f689d04d2518d3f5e4 (diff) |
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: Drew Davenport <ddavenport@chromium.org>
Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
-rw-r--r-- | drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c index b94987bb6af9..84591781fca1 100644 --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | |||
@@ -3853,8 +3853,7 @@ static void amdgpu_dm_commit_planes(struct drm_atomic_state *state, | |||
3853 | /* update planes when needed */ | 3853 | /* update planes when needed */ |
3854 | for_each_oldnew_plane_in_state(state, plane, old_plane_state, new_plane_state, i) { | 3854 | for_each_oldnew_plane_in_state(state, plane, old_plane_state, new_plane_state, i) { |
3855 | struct drm_crtc *crtc = new_plane_state->crtc; | 3855 | struct drm_crtc *crtc = new_plane_state->crtc; |
3856 | struct drm_crtc_state *new_crtc_state = | 3856 | struct drm_crtc_state *new_crtc_state; |
3857 | drm_atomic_get_new_crtc_state(state, crtc); | ||
3858 | struct drm_framebuffer *fb = new_plane_state->fb; | 3857 | struct drm_framebuffer *fb = new_plane_state->fb; |
3859 | bool pflip_needed; | 3858 | bool pflip_needed; |
3860 | struct dm_plane_state *dm_new_plane_state = to_dm_plane_state(new_plane_state); | 3859 | 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, | |||
3864 | continue; | 3863 | continue; |
3865 | } | 3864 | } |
3866 | 3865 | ||
3867 | if (!fb || !crtc || pcrtc != crtc || !new_crtc_state->active) | 3866 | if (!fb || !crtc || pcrtc != crtc) |
3867 | continue; | ||
3868 | |||
3869 | new_crtc_state = drm_atomic_get_new_crtc_state(state, crtc); | ||
3870 | if (!new_crtc_state->active) | ||
3868 | continue; | 3871 | continue; |
3869 | 3872 | ||
3870 | pflip_needed = !state->allow_modeset; | 3873 | pflip_needed = !state->allow_modeset; |