[PATCH xserver] modesetting: Don't deref crtc->scrn in drmmode_output_dpms()

Mario Kleiner mario.kleiner.de at gmail.com
Sat Mar 31 00:28:33 UTC 2018


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.de at gmail.com>
Suggested-by: Daniel Stone <daniels at 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



More information about the xorg-devel mailing list