mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-08-26 02:39:48 +00:00
drm/virtio: Fix double free on probe failure
[ Upstream commit cec7f17746
]
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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
69a71b59b1
commit
d2d17ca924
1 changed files with 1 additions and 0 deletions
|
@ -209,6 +209,7 @@ int virtio_gpu_init(struct drm_device *dev)
|
|||
err_vbufs:
|
||||
vgdev->vdev->config->del_vqs(vgdev->vdev);
|
||||
err_vqs:
|
||||
dev->dev_private = NULL;
|
||||
kfree(vgdev);
|
||||
return ret;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue