diff options
author | Xie Yongji <xieyongji@bytedance.com> | 2021-05-17 10:49:12 +0200 |
---|---|---|
committer | Gerd Hoffmann <kraxel@redhat.com> | 2021-05-18 10:55:30 +0200 |
commit | cec7f1774605a5ef47c134af62afe7c75c30b0ee (patch) | |
tree | 9558939082eabe2360067bf4fe0c9a360b27fd78 /drivers/gpu/drm/virtio/virtgpu_kms.c | |
parent | drm/virtio: Fixes a potential NULL pointer dereference on probe failure (diff) | |
download | linux-cec7f1774605a5ef47c134af62afe7c75c30b0ee.tar.xz linux-cec7f1774605a5ef47c134af62afe7c75c30b0ee.zip |
drm/virtio: Fix double free on probe failure
The virtio_gpu_init() will free vgdev and vgdev->vbufs on failure.
But such failure will be caught by virtio_gpu_probe() and then
virtio_gpu_release() will be called to do some cleanup which
will free vgdev and vgdev->vbufs again. So let's set dev->dev_private
to NULL to avoid double free.
Signed-off-by: Xie Yongji <xieyongji@bytedance.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20210517084913.403-2-xieyongji@bytedance.com
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Diffstat (limited to 'drivers/gpu/drm/virtio/virtgpu_kms.c')
-rw-r--r-- | drivers/gpu/drm/virtio/virtgpu_kms.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/drivers/gpu/drm/virtio/virtgpu_kms.c b/drivers/gpu/drm/virtio/virtgpu_kms.c index aa532ad31a23..f3379059f324 100644 --- a/drivers/gpu/drm/virtio/virtgpu_kms.c +++ b/drivers/gpu/drm/virtio/virtgpu_kms.c @@ -234,6 +234,7 @@ err_scanouts: err_vbufs: vgdev->vdev->config->del_vqs(vgdev->vdev); err_vqs: + dev->dev_private = NULL; kfree(vgdev); return ret; } |