[mutter/gnome-3-28] gpu-kms: Don't crash if drmModeGetResources returns NULL
- From: Jonas Ådahl <jadahl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter/gnome-3-28] gpu-kms: Don't crash if drmModeGetResources returns NULL
- Date: Thu, 19 Jul 2018 19:38:23 +0000 (UTC)
commit 62660bbd1526c6135d149df397b2470c6e71969d
Author: Aaron Plattner <aplattner nvidia com>
Date: Thu Jul 19 10:51:34 2018 -0700
gpu-kms: Don't crash if drmModeGetResources returns NULL
DRM drivers can be opened by meta_launcher_open_restricted() even if they don't
implement modesetting. However, drmModeGetResources() will return NULL.
Check whether that happened in meta_gpu_kms_new() and return with an error
instead of crashing.
Fixes #223.
src/backends/native/meta-gpu-kms.c | 7 +++++++
1 file changed, 7 insertions(+)
---
diff --git a/src/backends/native/meta-gpu-kms.c b/src/backends/native/meta-gpu-kms.c
index 613a60705..259cd7122 100644
--- a/src/backends/native/meta-gpu-kms.c
+++ b/src/backends/native/meta-gpu-kms.c
@@ -801,6 +801,13 @@ meta_gpu_kms_new (MetaMonitorManagerKms *monitor_manager_kms,
*/
drm_resources = drmModeGetResources (kms_fd);
+ if (!drm_resources)
+ {
+ g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED, "No resources");
+ meta_launcher_close_restricted (launcher, kms_fd);
+ return NULL;
+ }
+
n_connectors = drm_resources->count_connectors;
drmModeFreeResources (drm_resources);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]