[PATCH xf86-video-amdgpu] Bail from drmmode_cm_init if there's no CRTC

Deucher, Alexander Alexander.Deucher at amd.com
Thu Sep 13 14:17:30 UTC 2018


Reviewed-by: Alex Deucher <alexander.deucher at amd.com>

________________________________
From: amd-gfx <amd-gfx-bounces at lists.freedesktop.org> on behalf of Michel Dänzer <michel at daenzer.net>
Sent: Thursday, September 13, 2018 5:47:29 AM
To: amd-gfx at lists.freedesktop.org
Subject: [PATCH xf86-video-amdgpu] Bail from drmmode_cm_init if there's no CRTC

From: Michel Dänzer <michel.daenzer at amd.com>

We would crash due to dereferencing the NULL mode_res->crtc pointer.

Bugzilla: https://bugs.freedesktop.org/107913
Signed-off-by: Michel Dänzer <michel.daenzer at amd.com>
---
 src/drmmode_display.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/drmmode_display.c b/src/drmmode_display.c
index 6ef6a98e2..cbda8ad35 100644
--- a/src/drmmode_display.c
+++ b/src/drmmode_display.c
@@ -3198,6 +3198,9 @@ static void drmmode_cm_init(int drm_fd, drmmode_ptr drmmode,
         memset(drmmode->cm_prop_ids, 0, sizeof(drmmode->cm_prop_ids));
         drmmode->gamma_lut_size = drmmode->degamma_lut_size = 0;

+       if (!mode_res->crtcs)
+               return;
+
         /* AMD hardware has color management support on all pipes. It is
          * therefore sufficient to only check the first CRTC.
          */
--
2.19.0.rc2

_______________________________________________
amd-gfx mailing list
amd-gfx at lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/amd-gfx/attachments/20180913/3a5eeb0a/attachment.html>


More information about the amd-gfx mailing list