Commit cec7f177 authored by Xie Yongji's avatar Xie Yongji Committed by Gerd Hoffmann

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: default avatarXie Yongji <xieyongji@bytedance.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20210517084913.403-2-xieyongji@bytedance.comSigned-off-by: default avatarGerd Hoffmann <kraxel@redhat.com>
parent 17f46f48
...@@ -234,6 +234,7 @@ int virtio_gpu_init(struct drm_device *dev) ...@@ -234,6 +234,7 @@ int virtio_gpu_init(struct drm_device *dev)
err_vbufs: err_vbufs:
vgdev->vdev->config->del_vqs(vgdev->vdev); vgdev->vdev->config->del_vqs(vgdev->vdev);
err_vqs: err_vqs:
dev->dev_private = NULL;
kfree(vgdev); kfree(vgdev);
return ret; return ret;
} }
......
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