amdgpu/dc: Avoid dereferencing NULL pointer
Subsystems (3)
PATCH 1/1 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 <[email protected]>
--- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +6 -3
@@ -3874,8 +3874,7 @@ static void amdgpu_dm_commit_planes(struct drm_atomic_state *state,/* update planes when needed */ 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_state *new_crtc_state = -drm_atomic_get_new_crtc_state (state, crtc); +struct drm_crtc_state *new_crtc_state;struct drm_framebuffer *fb = new_plane_state->fb;bool pflip_needed;struct dm_plane_state *dm_new_plane_state =to_dm_plane_state (new_plane_state);
@@ -3885,7 +3884,11 @@ static void amdgpu_dm_commit_planes(struct drm_atomic_state *state,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 ; pflip_needed = !state->allow_modeset;
Signature · 6 lines
2.15.0.rc2.357.g7e34df9404-goog _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): 20171027183446.100536-1-ddavenport-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org
Harry Wentland
Reviewed-byQuoted 4 lines · Drew Davenport
crtc is dereferenced from within
drm_atomic_get_new_crtc_state, so check for NULL before initializingnew_crtc_state.Signed-off-by Drew Davenport <[email protected]>
Reviewed-by Harry Wentland <[email protected]>
Harry
Quoted 22 lines
--- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +1
-2@@ -3874,8 +3874,7 @@ static void amdgpu_dm_commit_planes(struct drm_atomic_state *state,/* update planes when needed */ 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_state *new_crtc_state = -drm_atomic_get_new_crtc_state (state, crtc); +struct drm_crtc_state *new_crtc_state;struct drm_framebuffer *fb = new_plane_state->fb;bool pflip_needed;struct dm_plane_state *dm_new_plane_state =to_dm_plane_state (new_plane_state);@@ -3885,7 +3884,11 @@ static void amdgpu_dm_commit_planes(struct drm_atomic_state *state,continue ; }
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c static void amdgpu_dm_commit_planes(struct drm_atomic_state *state, · line 3894
Quoted 10 lines
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +5
-1-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 ; pflip_needed = !state->allow_modeset;
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx