From: Lyude <cpaul@redhat.com>
To: Daniel Vetter <daniel@ffwll.ch>, intel-gfx@lists.freedesktop.org
Subject: [PATCH 4/4] drm/atomic: Verify connector->funcs != NULL when clearing states
Date: Thu, 12 May 2016 10:57:01 -0400 [thread overview]
Message-ID: <1463065021-18280-5-git-send-email-cpaul@redhat.com> (raw)
In-Reply-To: <1463065021-18280-1-git-send-email-cpaul@redhat.com>
Unfortunately since we don't have Dave's connector refcounting patch
here yet, it's very possible that drm_atomic_state_default_clear() could
get called by intel_display_resume() when
intel_dp_mst_destroy_connector() isn't completely finished destroying an
mst connector, but has already finished setting connector->funcs to
NULL. As such, we need to treat the connector like it's already been
destroyed and just skip it, otherwise we'll end up dereferencing a NULL
pointer.
This fix is only required for 4.6 and below. David Airlie's patchseries
for 4.7 to add connector reference counting provides a more proper fix
for this.
Upstream fix: b164d31f50b2923a7a92c2a40cb46973a6ba8c36
Cc: stable@vger.kernel.org
Signed-off-by: Lyude <cpaul@redhat.com>
---
drivers/gpu/drm/drm_atomic.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c
index 8ee1db8..d3a5b5c 100644
--- a/drivers/gpu/drm/drm_atomic.c
+++ b/drivers/gpu/drm/drm_atomic.c
@@ -139,7 +139,7 @@ void drm_atomic_state_default_clear(struct drm_atomic_state *state)
for (i = 0; i < state->num_connector; i++) {
struct drm_connector *connector = state->connectors[i];
- if (!connector)
+ if (!connector || !connector->funcs)
continue;
/*
@@ -150,6 +150,7 @@ void drm_atomic_state_default_clear(struct drm_atomic_state *state)
* case by setting all connector pointers to NULL.
*/
state->connector_states[i]->connector = NULL;
+
connector->funcs->atomic_destroy_state(NULL,
state->connector_states[i]);
state->connectors[i] = NULL;
--
2.5.5
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
next prev parent reply other threads:[~2016-05-12 14:57 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-05-12 14:56 [RESEND] [PATCH 0/4] Important MST fixes for 4.6 Lyude
2016-05-12 14:56 ` [PATCH 1/4] drm/i915/fbdev: Fix num_connector references in intel_fb_initial_config() Lyude
2016-05-12 14:56 ` [PATCH 2/4] drm/fb_helper: Fix references to dev->mode_config.num_connector Lyude
2016-05-12 21:47 ` [PATCH v2 3/4] drm/i915: Discard previous atomic state on resume if connectors change Lyude
2016-05-17 12:01 ` Daniel Vetter
2016-05-12 14:57 ` [PATCH " Lyude
2016-05-12 14:57 ` Lyude [this message]
2016-05-12 15:04 ` [PATCH 4/4] drm/atomic: Verify connector->funcs != NULL when clearing states Lyude
2016-05-17 12:00 ` Daniel Vetter
2016-05-12 16:48 ` ✗ Ro.CI.BAT: failure for Important MST fixes for 4.6 (rev2) Patchwork
2016-05-12 22:25 ` ✗ Ro.CI.BAT: failure for Important MST fixes for 4.6 (rev3) 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=1463065021-18280-5-git-send-email-cpaul@redhat.com \
--to=cpaul@redhat.com \
--cc=daniel@ffwll.ch \
--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;
as well as URLs for NNTP newsgroup(s).