mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-06 20:18:12 +02:00
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> (cherry picked from commiteb7897f57b) Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40752>
This commit is contained in:
parent
b6640c1609
commit
9ca275f29a
2 changed files with 6 additions and 4 deletions
|
|
@ -3844,7 +3844,7 @@
|
|||
"description": "tu/drm/virtio: Do not free iova from heap for lazy BOs",
|
||||
"nominated": true,
|
||||
"nomination_type": 2,
|
||||
"resolution": 0,
|
||||
"resolution": 1,
|
||||
"main_sha": null,
|
||||
"because_sha": "88d001383a7c5b3f27c80b9b063f29db88246e29",
|
||||
"notes": null
|
||||
|
|
|
|||
|
|
@ -775,9 +775,11 @@ virtio_bo_init(struct tu_device *dev,
|
|||
return VK_SUCCESS;
|
||||
|
||||
fail:
|
||||
mtx_lock(&dev->vma_mutex);
|
||||
util_vma_heap_free(&dev->vma, req.iova, size);
|
||||
mtx_unlock(&dev->vma_mutex);
|
||||
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
Reference in a new issue