From: Stanislav Lisovskiy <stanislav.lisovskiy@intel.com>
To: intel-gfx@lists.freedesktop.org
Subject: [Intel-gfx] [PATCH] drm/i915: Fix NULL ptr deref by checking new_crtc_state
Date: Fri, 5 May 2023 11:22:12 +0300 [thread overview]
Message-ID: <20230505082212.27089-1-stanislav.lisovskiy@intel.com> (raw)
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>
---
drivers/gpu/drm/i915/display/intel_atomic_plane.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/i915/display/intel_atomic_plane.c b/drivers/gpu/drm/i915/display/intel_atomic_plane.c
index 9f670dcfe76e..4125ee07a271 100644
--- a/drivers/gpu/drm/i915/display/intel_atomic_plane.c
+++ b/drivers/gpu/drm/i915/display/intel_atomic_plane.c
@@ -1029,7 +1029,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));
@@ -1044,7 +1044,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,
false, 0,
--
2.37.3
next reply other threads:[~2023-05-05 8:22 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-05-05 8:22 Stanislav Lisovskiy [this message]
2023-05-05 9:11 ` [Intel-gfx] ✓ Fi.CI.BAT: success for drm/i915: Fix NULL ptr deref by checking new_crtc_state Patchwork
2023-05-05 9:29 ` [Intel-gfx] [PATCH] " Andrzej Hajda
2023-05-05 10:28 ` Lisovskiy, Stanislav
2023-05-05 10:54 ` Ville Syrjälä
2023-05-05 10:58 ` Lisovskiy, Stanislav
2023-05-05 11:02 ` Ville Syrjälä
2023-05-05 11:05 ` Lisovskiy, Stanislav
2023-05-05 11:06 ` Ville Syrjälä
2023-05-05 11:08 ` Lisovskiy, Stanislav
2023-05-05 11:20 ` Lisovskiy, Stanislav
2023-05-05 11:25 ` Ville Syrjälä
2023-05-05 11:41 ` Lisovskiy, Stanislav
2023-05-05 12:09 ` Ville Syrjälä
2023-05-05 12:27 ` Lisovskiy, Stanislav
2023-05-05 12:46 ` Ville Syrjälä
2023-05-05 12:52 ` Lisovskiy, Stanislav
2023-05-05 13:52 ` Ville Syrjälä
2023-05-05 12:54 ` Lisovskiy, Stanislav
2023-05-05 13:11 ` Ville Syrjälä
2023-05-05 13:21 ` Lisovskiy, Stanislav
2023-05-05 13:28 ` Ville Syrjälä
2023-05-05 13:42 ` Lisovskiy, Stanislav
2023-05-05 13:57 ` Ville Syrjälä
2023-05-05 14:05 ` Lisovskiy, Stanislav
2023-05-05 14:17 ` Ville Syrjälä
2023-05-05 15:55 ` Lisovskiy, Stanislav
2023-05-05 16:44 ` Ville Syrjälä
2023-05-05 18:18 ` Lisovskiy, Stanislav
2023-05-06 0:38 ` [Intel-gfx] ✓ Fi.CI.IGT: success for " Patchwork
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230505082212.27089-1-stanislav.lisovskiy@intel.com \
--to=stanislav.lisovskiy@intel.com \
--cc=intel-gfx@lists.freedesktop.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox