crtc might be a NULL pointer. Use output->scrn instead.

Fixes crashes from some call paths of drmmode_output_dpms(),
e.g., when called from xf86DisableUnusedFunctions().

Fixes: ba0c75177239 ("modesetting: Fix up some XXX from removing 
GLAMOR_HAS_DRM_*")
Signed-off-by: Mario Kleiner <mario.kleiner...@gmail.com>
Suggested-by: Daniel Stone <dani...@collabora.com>
---
 hw/xfree86/drivers/modesetting/drmmode_display.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/xfree86/drivers/modesetting/drmmode_display.c 
b/hw/xfree86/drivers/modesetting/drmmode_display.c
index a70b4c6..4a98301 100644
--- a/hw/xfree86/drivers/modesetting/drmmode_display.c
+++ b/hw/xfree86/drivers/modesetting/drmmode_display.c
@@ -2267,7 +2267,7 @@ drmmode_output_dpms(xf86OutputPtr output, int mode)
 {
     drmmode_output_private_ptr drmmode_output = output->driver_private;
     xf86CrtcPtr crtc = output->crtc;
-    modesettingPtr ms = modesettingPTR(crtc->scrn);
+    modesettingPtr ms = modesettingPTR(output->scrn);
     drmModeConnectorPtr koutput = drmmode_output->mode_output;
     drmmode_ptr drmmode = drmmode_output->drmmode;
 
-- 
2.7.4

_______________________________________________
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel

Reply via email to