tu/drm/virtio: Move set_iova into success path of virtio_bo_init_dmabuf

set_iova() was called unconditionally after tu_bo_init(), even on the
failure path where the BO has been zeroed. This would call set_iova()
with res_id 0 and a stale iova, corrupting the iova mapping.

Move set_iova() into the success branch so it is only called when
tu_bo_init() succeeds.

Fixes: db88a490b8 ("tu: Avoid extraneous set_iova")
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 11:12:24 +01:00 committed by Marge Bot
parent 28e3fb7052
commit 7a96bc3187

View file

@ -855,10 +855,9 @@ virtio_bo_init_dmabuf(struct tu_device *dev,
memset(bo, 0, sizeof(*bo));
} else {
*out_bo = bo;
set_iova(dev, bo->res_id, iova);
}
set_iova(dev, bo->res_id, iova);
out_unlock:
u_rwlock_wrunlock(&dev->dma_bo_lock);
return result;