[PATCH] drm/virtio: fix memory leak in virtio_gpu_cleanup_object()

2020-07-22 Thread Xin He
Before setting shmem->pages to NULL, kfree() should
be called.

Signed-off-by: Xin He 
Reviewed-by: Qi Liu 
---
 drivers/gpu/drm/virtio/virtgpu_object.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/gpu/drm/virtio/virtgpu_object.c 
b/drivers/gpu/drm/virtio/virtgpu_object.c
index 6ccbd01cd888..703b5cd51751 100644
--- a/drivers/gpu/drm/virtio/virtgpu_object.c
+++ b/drivers/gpu/drm/virtio/virtgpu_object.c
@@ -79,6 +79,7 @@ void virtio_gpu_cleanup_object(struct virtio_gpu_object *bo)
}
 
sg_free_table(shmem->pages);
+   kfree(shmem->pages);
shmem->pages = NULL;
drm_gem_shmem_unpin(>base.base);
}
-- 
2.21.1 (Apple Git-122.3)

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH v3] drm/virtio: fix missing dma_fence_put() in virtio_gpu_execbuffer_ioctl()

2020-07-21 Thread Xin He
From: Qi Liu 

We should put the reference count of the fence after calling
virtio_gpu_cmd_submit(). So add the missing dma_fence_put().

Fixes: 2cd7b6f08bc4 ("drm/virtio: add in/out fence support for explicit 
synchronization")
Co-developed-by: Xin He 
Signed-off-by: Xin He 
Signed-off-by: Qi Liu 
Reviewed-by: Muchun Song 
---

changelog in v3:
1) Change the subject from "drm/virtio: fixed memory leak in 
virtio_gpu_execbuffer_ioctl()" to 
   "drm/virtio: fix missing dma_fence_put() in virtio_gpu_execbuffer_ioctl()"
2) Rework the commit log

changelog in v2:
1) Add a change description 

 drivers/gpu/drm/virtio/virtgpu_ioctl.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/gpu/drm/virtio/virtgpu_ioctl.c 
b/drivers/gpu/drm/virtio/virtgpu_ioctl.c
index 5df722072ba0..19c5bc01eb79 100644
--- a/drivers/gpu/drm/virtio/virtgpu_ioctl.c
+++ b/drivers/gpu/drm/virtio/virtgpu_ioctl.c
@@ -179,6 +179,7 @@ static int virtio_gpu_execbuffer_ioctl(struct drm_device 
*dev, void *data,
 
virtio_gpu_cmd_submit(vgdev, buf, exbuf->size,
  vfpriv->ctx_id, buflist, out_fence);
+   dma_fence_put(_fence->f);
virtio_gpu_notify(vgdev);
return 0;
 
-- 
2.21.1 (Apple Git-122.3)

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel