Skip to content

Commit 415cb45

Browse files
tdzdigetx
authored andcommitted
drm/virtio: Use dma_buf from GEM object instance
Avoid dereferencing struct drm_gem_object.import_attach for the imported dma-buf. The dma_buf field in the GEM object instance refers to the same buffer. Prepares to make import_attach optional. Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de> Reviewed-by: Dmitry Osipenko <dmitry.osipenko@collabora.com> Signed-off-by: Dmitry Osipenko <dmitry.osipenko@collabora.com> Link: https://lore.kernel.org/r/20250414131507.566072-3-tzimmermann@suse.de
1 parent 964f2a5 commit 415cb45

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

drivers/gpu/drm/virtio/virtgpu_prime.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -204,16 +204,15 @@ static void virtgpu_dma_buf_free_obj(struct drm_gem_object *obj)
204204
{
205205
struct virtio_gpu_object *bo = gem_to_virtio_gpu_obj(obj);
206206
struct virtio_gpu_device *vgdev = obj->dev->dev_private;
207-
struct dma_buf_attachment *attach = obj->import_attach;
208207

209208
if (drm_gem_is_imported(obj)) {
210-
struct dma_buf *dmabuf = attach->dmabuf;
209+
struct dma_buf *dmabuf = obj->dma_buf;
211210

212211
dma_resv_lock(dmabuf->resv, NULL);
213212
virtgpu_dma_buf_unmap(bo);
214213
dma_resv_unlock(dmabuf->resv);
215214

216-
dma_buf_detach(dmabuf, attach);
215+
dma_buf_detach(dmabuf, obj->import_attach);
217216
dma_buf_put(dmabuf);
218217
}
219218

0 commit comments

Comments
 (0)