summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Alexander Steffens (heftig) <heftig@archlinux.org>2022-12-04 00:21:45 +0000
committerEric Engestrom <eric@engestrom.ch>2022-12-14 20:47:00 +0000
commitff39ada94f841d82a85310e5dff6135eb123aa6d (patch)
tree5f393b7f6d1a108adf24bcfcefae17d1e7fa4840
parent1b27820b769087c1ff42ddd505a19be18b182e92 (diff)
downloadmesa-ff39ada94f841d82a85310e5dff6135eb123aa6d.tar.gz
dzn: Don't crash when libd3d12.so can't be found
`dzn_instance_create` will call `dzn_instance_destroy` when the d3d12 library fails to load. Just like the issue in `d3d12_screen`, this will lead to a crash because `d3d12_mod` is NULL. To fix this, only close the library after if it was actually opened. Cc: mesa-stable Reviewed-by: Jesse Natalie <jenatali@microsoft.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20145> (cherry picked from commit b5133894005720db24a8e0cc17e047a291953ff4)
-rw-r--r--.pick_status.json2
-rw-r--r--src/microsoft/vulkan/dzn_device.c3
2 files changed, 3 insertions, 2 deletions
diff --git a/.pick_status.json b/.pick_status.json
index c28142a42a2..92def1f576a 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -4009,7 +4009,7 @@
"description": "dzn: Don't crash when libd3d12.so can't be found",
"nominated": true,
"nomination_type": 0,
- "resolution": 0,
+ "resolution": 1,
"main_sha": null,
"because_sha": null
},
diff --git a/src/microsoft/vulkan/dzn_device.c b/src/microsoft/vulkan/dzn_device.c
index 8428f103fe9..9730636e82b 100644
--- a/src/microsoft/vulkan/dzn_device.c
+++ b/src/microsoft/vulkan/dzn_device.c
@@ -171,7 +171,8 @@ dzn_instance_destroy(struct dzn_instance *instance, const VkAllocationCallbacks
if (instance->factory)
ID3D12DeviceFactory_Release(instance->factory);
- util_dl_close(instance->d3d12_mod);
+ if (instance->d3d12_mod)
+ util_dl_close(instance->d3d12_mod);
vk_instance_finish(&instance->vk);
vk_free2(vk_default_allocator(), alloc, instance);