Mesa (main): vulkan/wsi: Unlock before return on error path.

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Nov 10 13:42:54 UTC 2021


Module: Mesa
Branch: main
Commit: 794a9cf3d6e7b2ccc7afc35009918fa87ff1026e
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=794a9cf3d6e7b2ccc7afc35009918fa87ff1026e

Author: Vinson Lee <vlee at freedesktop.org>
Date:   Sat Nov  6 15:56:21 2021 -0700

vulkan/wsi: Unlock before return on error path.

Fix defect reported by Coverity Scan.

Missing unlock (LOCK)
missing_unlock: Returning without unlocking wsi->wait_mutex.

Fixes: 4885e63a6d2 ("vulkan/wsi: implement missing wsi_register_device_event")
Signed-off-by: Vinson Lee <vlee at freedesktop.org>
Reviewed-by: Jason Ekstrand <jason at jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13698>

---

 src/vulkan/wsi/wsi_common_display.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/vulkan/wsi/wsi_common_display.c b/src/vulkan/wsi/wsi_common_display.c
index dae6adc5b72..50a821c3f33 100644
--- a/src/vulkan/wsi/wsi_common_display.c
+++ b/src/vulkan/wsi/wsi_common_display.c
@@ -2683,8 +2683,10 @@ wsi_register_device_event(VkDevice device,
    mtx_lock(&wsi->wait_mutex);
    if (!wsi->hotplug_thread) {
       if (pthread_create(&wsi->hotplug_thread, NULL, udev_event_listener_thread,
-                         wsi_device))
+                         wsi_device)) {
+         mtx_unlock(&wsi->wait_mutex);
          return VK_ERROR_OUT_OF_HOST_MEMORY;
+      }
    }
    mtx_unlock(&wsi->wait_mutex);
 #endif



More information about the mesa-commit mailing list