Commit a2746d8b authored by Gerd Hoffmann's avatar Gerd Hoffmann Committed by Greg Kroah-Hartman

drm/virtio: don't leak bo on drm_gem_object_init failure

commit 385aee96 upstream.
Reported-by: default avatar李强 <liqiang6-s@360.cn>
Signed-off-by: default avatarGerd Hoffmann <kraxel@redhat.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20170406155941.458-1-kraxel@redhat.comSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 7dde6934
...@@ -81,8 +81,10 @@ int virtio_gpu_object_create(struct virtio_gpu_device *vgdev, ...@@ -81,8 +81,10 @@ int virtio_gpu_object_create(struct virtio_gpu_device *vgdev,
return -ENOMEM; return -ENOMEM;
size = roundup(size, PAGE_SIZE); size = roundup(size, PAGE_SIZE);
ret = drm_gem_object_init(vgdev->ddev, &bo->gem_base, size); ret = drm_gem_object_init(vgdev->ddev, &bo->gem_base, size);
if (ret != 0) if (ret != 0) {
kfree(bo);
return ret; return ret;
}
bo->dumb = false; bo->dumb = false;
virtio_gpu_init_ttm_placement(bo, pinned); virtio_gpu_init_ttm_placement(bo, pinned);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment