Blame SOURCES/0001-gpu-kms-Don-t-crash-if-drmModeGetResources-returns-N.patch
|
|
776610 |
From 62660bbd1526c6135d149df397b2470c6e71969d Mon Sep 17 00:00:00 2001
|
|
|
776610 |
From: Aaron Plattner <aplattner@nvidia.com>
|
|
|
776610 |
Date: Thu, 19 Jul 2018 10:51:34 -0700
|
|
|
776610 |
Subject: [PATCH] gpu-kms: Don't crash if drmModeGetResources returns NULL
|
|
|
776610 |
|
|
|
776610 |
DRM drivers can be opened by meta_launcher_open_restricted() even if they don't
|
|
|
776610 |
implement modesetting. However, drmModeGetResources() will return NULL.
|
|
|
776610 |
|
|
|
776610 |
Check whether that happened in meta_gpu_kms_new() and return with an error
|
|
|
776610 |
instead of crashing.
|
|
|
776610 |
|
|
|
776610 |
Fixes #223.
|
|
|
776610 |
---
|
|
|
776610 |
src/backends/native/meta-gpu-kms.c | 7 +++++++
|
|
|
776610 |
1 file changed, 7 insertions(+)
|
|
|
776610 |
|
|
|
776610 |
diff --git a/src/backends/native/meta-gpu-kms.c b/src/backends/native/meta-gpu-kms.c
|
|
|
776610 |
index 613a60705..259cd7122 100644
|
|
|
776610 |
--- a/src/backends/native/meta-gpu-kms.c
|
|
|
776610 |
+++ b/src/backends/native/meta-gpu-kms.c
|
|
|
776610 |
@@ -801,6 +801,13 @@ meta_gpu_kms_new (MetaMonitorManagerKms *monitor_manager_kms,
|
|
|
776610 |
*/
|
|
|
776610 |
drm_resources = drmModeGetResources (kms_fd);
|
|
|
776610 |
|
|
|
776610 |
+ if (!drm_resources)
|
|
|
776610 |
+ {
|
|
|
776610 |
+ g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED, "No resources");
|
|
|
776610 |
+ meta_launcher_close_restricted (launcher, kms_fd);
|
|
|
776610 |
+ return NULL;
|
|
|
776610 |
+ }
|
|
|
776610 |
+
|
|
|
776610 |
n_connectors = drm_resources->count_connectors;
|
|
|
776610 |
|
|
|
776610 |
drmModeFreeResources (drm_resources);
|
|
|
776610 |
--
|
|
|
776610 |
2.19.0
|
|
|
776610 |
|