vkfencecache: call parent release() only after resources have been removed

The parent class will allow the handle to be reused at the end of the function.
If we are still modifying the released fence, then another thread can acquire
the fence while we are still clearing some of its data and produce a data race
or a leaked fence depending on which thread wins.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/8491>
This commit is contained in:
Matthew Waters 2025-02-13 21:10:40 +11:00 committed by GStreamer Marge Bot
parent ec679507f6
commit a2320509b4

View File

@ -236,15 +236,19 @@ gst_vulkan_fence_cache_release_impl (GstVulkanHandlePool * pool,
gpointer handle)
{
GstVulkanFence *fence = handle;
GstVulkanFenceCache *cache = NULL;
gst_vulkan_fence_reset (fence);
GST_VULKAN_HANDLE_POOL_CLASS (parent_class)->release (pool, handle);
if (fence) {
gst_clear_object (&fence->cache);
cache = fence->cache;
fence->cache = NULL;
gst_clear_object (&fence->device);
}
GST_VULKAN_HANDLE_POOL_CLASS (parent_class)->release (pool, handle);
gst_clear_object (&cache);
}
static void