summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErik Kurzinger <ekurzinger@nvidia.com>2021-05-03 08:18:03 -0400
committerEric Engestrom <eric@engestrom.ch>2021-06-02 20:08:40 +0200
commitb7be28b0627760e69077575476f517bd12873790 (patch)
tree881e58ee6f336f0458efa50cf919754983c3109f
parentb84b2bcd7587893d874e52aab8a833e045804323 (diff)
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@nvidia.com> Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com> Reviewed-by: Eric Engestrom <eric@engestrom.ch> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10598> (cherry picked from commit f4eb13dc55446794c4449386fa7f838ed061ce19)
-rw-r--r--.pick_status.json2
-rw-r--r--src/vulkan/device-select-layer/device_select_wayland.c3
2 files changed, 3 insertions, 2 deletions
diff --git a/.pick_status.json b/.pick_status.json
index d4b76c63e64..920e401f5b4 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -9985,7 +9985,7 @@
"description": "vulkan/device_select: avoid segfault on Wayland if wl_drm is unavailable",
"nominated": false,
"nomination_type": null,
- "resolution": 4,
+ "resolution": 1,
"main_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: