Skip to content

Commit a41d985

Browse files
StanFox1984jlahtine-intel
authored andcommitted
drm/i915: Fix NULL ptr deref by checking new_crtc_state
intel_atomic_get_new_crtc_state can return NULL, unless crtc state wasn't obtained previously with intel_atomic_get_crtc_state, so we must check it for NULLness here, just as in many other places, where we can't guarantee that intel_atomic_get_crtc_state was called. We are currently getting NULL ptr deref because of that, so this fix was confirmed to help. Fixes: 74a75dc ("drm/i915/display: move plane prepare/cleanup to intel_atomic_plane.c") Signed-off-by: Stanislav Lisovskiy <stanislav.lisovskiy@intel.com> Reviewed-by: Andrzej Hajda <andrzej.hajda@intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/20230505082212.27089-1-stanislav.lisovskiy@intel.com (cherry picked from commit 1d5b09f) Signed-off-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
1 parent 275dac1 commit a41d985

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/gpu/drm/i915/display/intel_atomic_plane.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1028,7 +1028,7 @@ intel_prepare_plane_fb(struct drm_plane *_plane,
10281028
int ret;
10291029

10301030
if (old_obj) {
1031-
const struct intel_crtc_state *crtc_state =
1031+
const struct intel_crtc_state *new_crtc_state =
10321032
intel_atomic_get_new_crtc_state(state,
10331033
to_intel_crtc(old_plane_state->hw.crtc));
10341034

@@ -1043,7 +1043,7 @@ intel_prepare_plane_fb(struct drm_plane *_plane,
10431043
* This should only fail upon a hung GPU, in which case we
10441044
* can safely continue.
10451045
*/
1046-
if (intel_crtc_needs_modeset(crtc_state)) {
1046+
if (new_crtc_state && intel_crtc_needs_modeset(new_crtc_state)) {
10471047
ret = i915_sw_fence_await_reservation(&state->commit_ready,
10481048
old_obj->base.resv,
10491049
false, 0,

0 commit comments

Comments
 (0)