Skip to content
Snippets Groups Projects
Commit c0a4f56f authored by Lionel Landwerlin's avatar Lionel Landwerlin
Browse files

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: 818b8579 ("anv: Use the BO cache for DeviceMemory allocations")
Signed-off-by: default avatarLionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: default avatarDaniel Stone <daniels@collabora.com>
Cc: mesa-stable@lists.freedesktop.org
parent cf3dd919
No related branches found
No related tags found
No related merge requests found
......@@ -1302,7 +1302,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);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment