drm/i915: Fix NULL ptr deref by checking new_crtc_state
authorjsg <jsg@openbsd.org>
Thu, 15 Jun 2023 02:39:37 +0000 (02:39 +0000)
committerjsg <jsg@openbsd.org>
Thu, 15 Jun 2023 02:39:37 +0000 (02:39 +0000)
From Stanislav Lisovskiy
dbf25cc21beff4fd2e730573845a266504b21bb2 in linux-6.1.y/6.1.30
a41d985902c153c31c616fe183cf2ee331e95ecb in mainline linux

sys/dev/pci/drm/i915/display/intel_atomic_plane.c

index aaa6708..8282645 100644 (file)
@@ -988,7 +988,7 @@ intel_prepare_plane_fb(struct drm_plane *_plane,
        int ret;
 
        if (old_obj) {
-               const struct intel_crtc_state *crtc_state =
+               const struct intel_crtc_state *new_crtc_state =
                        intel_atomic_get_new_crtc_state(state,
                                                        to_intel_crtc(old_plane_state->hw.crtc));
 
@@ -1003,7 +1003,7 @@ intel_prepare_plane_fb(struct drm_plane *_plane,
                 * This should only fail upon a hung GPU, in which case we
                 * can safely continue.
                 */
-               if (intel_crtc_needs_modeset(crtc_state)) {
+               if (new_crtc_state && intel_crtc_needs_modeset(new_crtc_state)) {
                        ret = i915_sw_fence_await_reservation(&state->commit_ready,
                                                              old_obj->base.resv, NULL,
                                                              false, 0,