提交 09bd9002 编写于 作者: X Xie Yongji 提交者: openeuler-sync-bot

drm/virtio: Fixes a potential NULL pointer dereference on probe failure

mainline inclusion
from mainline-v5.13-rc2
commit 17f46f48
category: bugfix
bugzilla: https://gitee.com/openeuler/stratovirt/issues/I66GGJ
CVE: NA

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?h=v5.15&id=17f46f488a5d82c5568e6e786cd760bba1c2ee09

--------------------------------

The dev->dev_private might not be allocated if virtio_gpu_pci_quirk()
or virtio_gpu_init() failed. In this case, we should avoid the cleanup
in virtio_gpu_release().
Signed-off-by: NXie Yongji <xieyongji@bytedance.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20210517084913.403-1-xieyongji@bytedance.comSigned-off-by: NGerd Hoffmann <kraxel@redhat.com>
Signed-off-by: NBinfeng Wu <wubinfeng@huawei.com>
(cherry picked from commit 41167b93)
上级 85f9b137
...@@ -240,6 +240,9 @@ void virtio_gpu_release(struct drm_device *dev) ...@@ -240,6 +240,9 @@ void virtio_gpu_release(struct drm_device *dev)
{ {
struct virtio_gpu_device *vgdev = dev->dev_private; struct virtio_gpu_device *vgdev = dev->dev_private;
if (!vgdev)
return;
virtio_gpu_modeset_fini(vgdev); virtio_gpu_modeset_fini(vgdev);
virtio_gpu_free_vbufs(vgdev); virtio_gpu_free_vbufs(vgdev);
virtio_gpu_cleanup_cap_cache(vgdev); virtio_gpu_cleanup_cap_cache(vgdev);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册