Skip to content

Commit 8b5249c

Browse files
ryanKkaiiicharles-lunarg
authored andcommitted
fix call DestroyInstance after loader_platform_close_library
Found that vkcts crash after "Get real path to layer & driver binaries : 77ccbe4" merged into vullan-loader. The root cause of crash is icd.so lib has been closed before DestroyInstance called in loader free path when icd instance has been created and oom in layer. eg. fpCreateInstance success but table->populate oom in wsi. TRY_LOG(fpCreateInstance(&modified_info, pAllocator, pInstance) , "Failed to create the instance"); TRY_LOG_CALL(table->populate(*pInstance, fpGetInstanceProcAddr, api_version)); So we need to defer close icd lib until DestroyInstance done. Fix case: dEQP-VK.api.device_init.create_instance_device_ intentional_alloc_fail.basic Signed-off-by: Ryan Zhang <ryan.zhang@nxp.com>
1 parent 655909f commit 8b5249c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

loader/trampoline.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -735,7 +735,6 @@ LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkCreateInstance(const VkInstanceCr
735735
loader_destroy_pointer_layer_list(ptr_instance, &ptr_instance->app_activated_layer_list);
736736

737737
loader_delete_layer_list_and_properties(ptr_instance, &ptr_instance->instance_layer_list);
738-
loader_clear_scanned_icd_list(ptr_instance, &ptr_instance->icd_tramp_list);
739738
loader_destroy_generic_list(ptr_instance, (struct loader_generic_list *)&ptr_instance->ext_list);
740739

741740
// Free any icd_terms that were created.
@@ -755,6 +754,7 @@ LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkCreateInstance(const VkInstanceCr
755754
loader_icd_destroy(ptr_instance, icd_term, pAllocator);
756755
}
757756

757+
loader_clear_scanned_icd_list(ptr_instance, &ptr_instance->icd_tramp_list);
758758
free_string_list(ptr_instance, &ptr_instance->enabled_layer_names);
759759

760760
loader_instance_heap_free(ptr_instance, ptr_instance);

0 commit comments

Comments
 (0)