Skip to content

Commit cd234b0

Browse files
ickledanvet
authored andcommitted
drm/i915: Do not dereference NULL crtc or fb until after checking
Fixes regression from commit 4906557 Author: Rodrigo Vivi <[email protected]> Date: Thu Jul 11 18:45:05 2013 -0300 drm/i915: Hook PSR functionality Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=67526 Signed-off-by: Chris Wilson <[email protected]> Cc: Rodrigo Vivi <[email protected]> Cc: Daniel Vetter <[email protected]> Signed-off-by: Ben Widawsky <[email protected]> Signed-off-by: Daniel Vetter <[email protected]>
1 parent 257a7ff commit cd234b0

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

drivers/gpu/drm/i915/intel_dp.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1545,12 +1545,21 @@ static bool intel_edp_psr_match_conditions(struct intel_dp *intel_dp)
15451545
return false;
15461546
}
15471547

1548+
crtc = dig_port->base.base.crtc;
1549+
if (crtc == NULL) {
1550+
DRM_DEBUG_KMS("crtc not active for PSR\n");
1551+
dev_priv->no_psr_reason = PSR_CRTC_NOT_ACTIVE;
1552+
return false;
1553+
}
1554+
1555+
intel_crtc = to_intel_crtc(crtc);
15481556
if (!intel_crtc->active || !crtc->fb || !crtc->mode.clock) {
15491557
DRM_DEBUG_KMS("crtc not active for PSR\n");
15501558
dev_priv->no_psr_reason = PSR_CRTC_NOT_ACTIVE;
15511559
return false;
15521560
}
15531561

1562+
obj = to_intel_framebuffer(crtc->fb)->obj;
15541563
if (obj->tiling_mode != I915_TILING_X ||
15551564
obj->fence_reg == I915_FENCE_REG_NONE) {
15561565
DRM_DEBUG_KMS("PSR condition failed: fb not tiled or fenced\n");

0 commit comments

Comments
 (0)