mirror of
https://github.com/brl/mutter.git
synced 2024-11-24 09:00:42 -05:00
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.
This commit is contained in:
parent
4e57e4c4f8
commit
5e56384636
@ -804,6 +804,13 @@ meta_gpu_kms_new (MetaMonitorManagerKms *monitor_manager_kms,
|
|||||||
*/
|
*/
|
||||||
drm_resources = drmModeGetResources (kms_fd);
|
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;
|
n_connectors = drm_resources->count_connectors;
|
||||||
|
|
||||||
drmModeFreeResources (drm_resources);
|
drmModeFreeResources (drm_resources);
|
||||||
|
Loading…
Reference in New Issue
Block a user