Skip to content

Commit

Permalink
drm/virtio: fix memory leak in virtio_gpu_cleanup_object()
Browse files Browse the repository at this point in the history
[ Upstream commit 836b194 ]

Before setting shmem->pages to NULL, kfree() should
be called.

Signed-off-by: Xin He <hexin.op@bytedance.com>
Reviewed-by: Qi Liu <liuqi.16@bytedance.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20200722051851.72662-1-hexin.op@bytedance.com
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
Xin He authored and gregkh committed Sep 3, 2020
1 parent f2fb15e commit c8bf676
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions drivers/gpu/drm/virtio/virtgpu_object.c
Expand Up @@ -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);
}
Expand Down

0 comments on commit c8bf676

Please sign in to comment.