Mesa (staging/21.1): vulkan/device_select: avoid segfault on Wayland if wl_drm is unavailable
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Tue May 4 22:02:30 UTC 2021
Module: Mesa
Branch: staging/21.1
Commit: b849e317a10c9407fe0ba0507c13f800bdea612f
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=b849e317a10c9407fe0ba0507c13f800bdea612f
Author: Erik Kurzinger <ekurzinger at nvidia.com>
Date: Mon May 3 08:18:03 2021 -0400
vulkan/device_select: avoid segfault on Wayland if wl_drm is unavailable
On Wayland, if the wl_drm interface is not available, for example if the
compositor is using the proprietary NVIDIA driver along with their egl-wayland
library, the device_select layer will fail to initialize. However, the failure
path will unconditionally call wl_drm_destroy even though info.wl_drm would be
NULL in that case. This can cause a segfault in libwayland-client.so.
To fix this, check if info.wl_drm is NULL before calling wl_drm_destroy. This
way, initialization will fail gracefully even if that interface is not present.
Signed-off-by: Erik Kurzinger <ekurzinger at nvidia.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin at intel.com>
Reviewed-by: Eric Engestrom <eric at engestrom.ch>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10598>
(cherry picked from commit f4eb13dc55446794c4449386fa7f838ed061ce19)
---
.pick_status.json | 2 +-
src/vulkan/device-select-layer/device_select_wayland.c | 3 ++-
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/.pick_status.json b/.pick_status.json
index 8b53ecc476b..2c47245eb7b 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -4,7 +4,7 @@
"description": "vulkan/device_select: avoid segfault on Wayland if wl_drm is unavailable",
"nominated": false,
"nomination_type": null,
- "resolution": 4,
+ "resolution": 1,
"master_sha": null,
"because_sha": null
},
diff --git a/src/vulkan/device-select-layer/device_select_wayland.c b/src/vulkan/device-select-layer/device_select_wayland.c
index 73db275a55a..161310b0292 100644
--- a/src/vulkan/device-select-layer/device_select_wayland.c
+++ b/src/vulkan/device-select-layer/device_select_wayland.c
@@ -139,7 +139,8 @@ int device_select_find_wayland_pci_default(struct device_pci_info *devices, uint
}
}
- wl_drm_destroy(info.wl_drm);
+ if (info.wl_drm)
+ wl_drm_destroy(info.wl_drm);
wl_registry_destroy(registry);
wl_display_disconnect(display);
out:
More information about the mesa-commit
mailing list