tu/drm/virtio: Do not free iova from heap for lazy BOs
When initializing a BO using a lazy VMA, the iova is provided by
the sparse VMA and was not allocated from the device's VMA heap.
Avoid calling util_vma_heap_free in the error path for such BOs
to prevent heap corruption and potential double-frees.
Fixes: 88d001383a ("tu: Add support for a "lazy" sparse VMA")
Signed-off-by: Valentine Burley <valentine.burley@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40507>
This commit is contained in:
parent
f1366ca144
commit
eb7897f57b
1 changed files with 5 additions and 3 deletions
|
|
@ -775,9 +775,11 @@ virtio_bo_init(struct tu_device *dev,
|
|||
return VK_SUCCESS;
|
||||
|
||||
fail:
|
||||
if (!lazy_vma) {
|
||||
mtx_lock(&dev->vma_mutex);
|
||||
util_vma_heap_free(&dev->vma, req.iova, size);
|
||||
mtx_unlock(&dev->vma_mutex);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue