drm/amd/display: Fix NULL ptr deref for commit_planes_to_stream
authorNicholas Kazlauskas <nicholas.kazlauskas@amd.com>
Fri, 30 Nov 2018 14:56:02 +0000 (09:56 -0500)
committerAlex Deucher <alexander.deucher@amd.com>
Fri, 30 Nov 2018 17:00:38 +0000 (12:00 -0500)
[Why]
With scaling, underscan and abm changes we can end up calling
commit_planes_to_stream in commit_tail. This call uses dm_state->context
which can be NULL if the commit was a fast update.

[How]
Use dc_state instead since that can't be NULL unless the system ran
out of memory.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=108912
Fixes: e64abff2f133 ("drm/amd/display: Use private obj helpers for dm_atomic_state")
Signed-off-by: Nicholas Kazlauskas <nicholas.kazlauskas@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Leo Li <sunpeng.li@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c

index c791003c813327c280d97617b8f7d82a3f091512..32e791d9b9a8ba5290381b2685b4336b1e203031 100644 (file)
@@ -5009,7 +5009,7 @@ static void amdgpu_dm_atomic_commit_tail(struct drm_atomic_state *state)
                                status->plane_count,
                                dm_new_crtc_state,
                                to_dm_crtc_state(old_crtc_state),
-                               dm_state->context))
+                               dc_state))
                        dm_error("%s: Failed to update stream scaling!\n", __func__);
        }