From b75a92e2010e81fdd387f1eae3be11e327d0a0bf Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Wed, 16 Sep 2020 12:38:58 -0400 Subject: [PATCH] anv: assert that the target bo is valid when adding a reloc list this catches some undefined behavior like e.g., using a stale descriptorset that references deleted bos, which I would absolutely never do Reviewed-by: Jason Ekstrand Part-of: --- src/intel/vulkan/anv_batch_chain.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/intel/vulkan/anv_batch_chain.c b/src/intel/vulkan/anv_batch_chain.c index c584f6f0b03..e5d0e140cdf 100644 --- a/src/intel/vulkan/anv_batch_chain.c +++ b/src/intel/vulkan/anv_batch_chain.c @@ -200,6 +200,8 @@ anv_reloc_list_add(struct anv_reloc_list *list, if (result != VK_SUCCESS) return result; + assert(target_bo->gem_handle > 0 && target_bo->refcount > 0); + /* XXX: Can we use I915_EXEC_HANDLE_LUT? */ index = list->num_relocs++; list->reloc_bos[index] = target_bo;