Sasha Levin
2020-Aug-24 16:34 UTC
[PATCH AUTOSEL 5.8 06/63] drm/virtio: fix memory leak in virtio_gpu_cleanup_object()
From: Xin He <hexin.op at bytedance.com> [ Upstream commit 836b194d65782aaec4485a07d2aab52d3f698505 ] Before setting shmem->pages to NULL, kfree() should be called. Signed-off-by: Xin He <hexin.op at bytedance.com> Reviewed-by: Qi Liu <liuqi.16 at bytedance.com> Link: http://patchwork.freedesktop.org/patch/msgid/20200722051851.72662-1-hexin.op at bytedance.com Signed-off-by: Gerd Hoffmann <kraxel at redhat.com> Signed-off-by: Sasha Levin <sashal at kernel.org> --- 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 6ccbd01cd888c..703b5cd517519 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(&bo->base.base); } -- 2.25.1
Reasonably Related Threads
- [PATCH AUTOSEL 5.7 05/54] drm/virtio: fix memory leak in virtio_gpu_cleanup_object()
- [PATCH 3/4] drm/virtio: move mapping teardown to virtio_gpu_cleanup_object()
- [PATCH v2 3/4] drm/virtio: move mapping teardown to virtio_gpu_cleanup_object()
- [PATCH v3] drm/virtio: fix missing dma_fence_put() in virtio_gpu_execbuffer_ioctl()
- [PATCH 4/4] drm/virtio: move virtio_gpu_mem_entry initialization to new function