From c373b24369808f30535bd5e72effa252b2fd7c1e Mon Sep 17 00:00:00 2001 From: =?utf8?q?Alejandro=20Pi=C3=B1eiro?= Date: Tue, 16 Mar 2021 22:07:44 +0000 Subject: [PATCH] v3dv/descriptor_set: don't free individual set if not allowed If we have a host_memory_base pointer it means that we are handling the pool memory as a whole, so each set is a sub-slice of the memory pool. In this case we can't just free the individual set. In other words, VK_DESCRIPTOR_POOL_CREATE_FREE_DESCRIPTOR_SET_BIT is not set. Note tha at that point we were able to sub-allocate an set, and we are failing to sub-allocate the pool bo for the descripto bo. So technically we could try to return that set to the pool (so undo the change on host_memory_ptr before), that I assume was my intention when (wrongly) calling vk_free there. But in practice, at that point we are already on a out of descriptor pool situation, so in the end it doesn't even matter. This fixes a double free crash with the UE4 VehicleGame demo. Reviewed-by: Iago Toral Quiroga Part-of: --- src/broadcom/vulkan/v3dv_descriptor_set.c | 1 - 1 file changed, 1 deletion(-) diff --git a/src/broadcom/vulkan/v3dv_descriptor_set.c b/src/broadcom/vulkan/v3dv_descriptor_set.c index 54787c9..7b41f91 100644 --- a/src/broadcom/vulkan/v3dv_descriptor_set.c +++ b/src/broadcom/vulkan/v3dv_descriptor_set.c @@ -829,7 +829,6 @@ descriptor_set_create(struct v3dv_device *device, sizeof(pool->entries[0]) * (pool->entry_count - index)); } else { assert(pool->host_memory_base); - vk_object_free(&device->vk, NULL, set); return out_of_pool_memory(device, pool); } -- 2.7.4