tu/drm/virtio: Fix GEM handle leak in tu_bo_init error path

In tu_bo_init, if growing the submit BO list fails, the GEM handle
must be closed. However, bo->gem_handle is only populated later
via compound assignment. Use the gem_handle parameter directly
to ensure the correct handle is closed and not leaked.

Fixes: d67d501af4 ("tu/drm/virtio: Switch to vdrm helper")
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:
Valentine Burley 2026-03-19 20:01:13 +01:00 committed by Marge Bot
parent eb7897f57b
commit 316d9b0209

View file

@ -593,7 +593,7 @@ tu_bo_init(struct tu_device *dev,
if (!new_ptr) {
dev->submit_bo_count--;
mtx_unlock(&dev->bo_mutex);
vdrm_bo_close(dev->vdev->vdrm, bo->gem_handle);
vdrm_bo_close(dev->vdev->vdrm, gem_handle);
return VK_ERROR_OUT_OF_HOST_MEMORY;
}