aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLionel Landwerlin <[email protected]>2017-10-11 17:21:53 +0100
committerEmil Velikov <[email protected]>2017-10-17 16:59:31 +0100
commit6957dfb0d806162cc7f62b2085fb0aed74dc9d8c (patch)
tree63ebcdcfedf7672bda5efad2a2314d8bad7cfa8c
parent410f4dbcb16b10627382b66428290f8a5fc9d74a (diff)
anv: bo_cache: allow importing a BO larger than needed
It's not a problem if a BO has been allocated larger than we need it to be. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=102940 Fixes: 818b857914 ("anv: Use the BO cache for DeviceMemory allocations") Signed-off-by: Lionel Landwerlin <[email protected]> Reviewed-by: Daniel Stone <[email protected]> Cc: [email protected] (cherry picked from commit c0a4f56fb9945e36a004bc38852fbb801aae3bd5)
-rw-r--r--src/intel/vulkan/anv_allocator.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/intel/vulkan/anv_allocator.c b/src/intel/vulkan/anv_allocator.c
index efaaebcf39c..a11d66145f0 100644
--- a/src/intel/vulkan/anv_allocator.c
+++ b/src/intel/vulkan/anv_allocator.c
@@ -1300,7 +1300,7 @@ anv_bo_cache_import(struct anv_device *device,
* this sort of attack but only if it can trust the buffer size.
*/
off_t import_size = lseek(fd, 0, SEEK_END);
- if (import_size == (off_t)-1 || import_size != size) {
+ if (import_size == (off_t)-1 || import_size < size) {
anv_gem_close(device, gem_handle);
pthread_mutex_unlock(&cache->mutex);
return vk_error(VK_ERROR_INVALID_EXTERNAL_HANDLE_KHR);