drm/i915: Fix NULL ptr deref by checking new_crtc_state
authorStanislav Lisovskiy <stanislav.lisovskiy@intel.com>
Fri, 5 May 2023 08:22:12 +0000 (11:22 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 24 May 2023 16:32:33 +0000 (17:32 +0100)
commitdbf25cc21beff4fd2e730573845a266504b21bb2
treee93e086ee2eee9784d6b0670d3021512d72f6ba5
parent1b485f39acf31e71bf30f32a0642310c1661743c
drm/i915: Fix NULL ptr deref by checking new_crtc_state

[ Upstream commit a41d985902c153c31c616fe183cf2ee331e95ecb ]

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: 74a75dc90869 ("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 1d5b09f8daf859247a1ea65b0d732a24d88980d8)
Signed-off-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/gpu/drm/i915/display/intel_atomic_plane.c