diff options
author | Gerd Hoffmann <kraxel@redhat.com> | 2017-04-06 18:59:40 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2017-07-12 16:01:03 +0300 |
commit | 366d9207d9e002bf1a6d9da13a7f8f85b8a40c0b (patch) | |
tree | 437919da76e1c3b97eb66e3f8b48ce43b6d6cbbb | |
parent | b96976c1a87bc48ddd5f32566c682cd376e4b785 (diff) | |
download | linux-366d9207d9e002bf1a6d9da13a7f8f85b8a40c0b.tar.xz |
drm/virtio: don't leak bo on drm_gem_object_init failure
commit 385aee965b4e4c36551c362a334378d2985b722a upstream.
Reported-by: 李强 <liqiang6-s@360.cn>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20170406155941.458-1-kraxel@redhat.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | drivers/gpu/drm/virtio/virtgpu_object.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/gpu/drm/virtio/virtgpu_object.c b/drivers/gpu/drm/virtio/virtgpu_object.c index 1483daebe057..6f66b7347cd0 100644 --- a/drivers/gpu/drm/virtio/virtgpu_object.c +++ b/drivers/gpu/drm/virtio/virtgpu_object.c @@ -81,8 +81,10 @@ int virtio_gpu_object_create(struct virtio_gpu_device *vgdev, return -ENOMEM; size = roundup(size, PAGE_SIZE); ret = drm_gem_object_init(vgdev->ddev, &bo->gem_base, size); - if (ret != 0) + if (ret != 0) { + kfree(bo); return ret; + } bo->dumb = false; virtio_gpu_init_ttm_placement(bo, pinned); |