All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/3] drm/virtio: Fixes a potential NULL pointer dereference on probe failure
@ 2021-05-17  8:49 ` Xie Yongji
  0 siblings, 0 replies; 9+ messages in thread
From: Xie Yongji @ 2021-05-17  8:49 UTC (permalink / raw)
  To: airlied, kraxel, daniel; +Cc: dri-devel, virtualization, linux-kernel

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: Xie Yongji <xieyongji@bytedance.com>
---
 drivers/gpu/drm/virtio/virtgpu_kms.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/gpu/drm/virtio/virtgpu_kms.c b/drivers/gpu/drm/virtio/virtgpu_kms.c
index b375394193be..aa532ad31a23 100644
--- a/drivers/gpu/drm/virtio/virtgpu_kms.c
+++ b/drivers/gpu/drm/virtio/virtgpu_kms.c
@@ -264,6 +264,9 @@ void virtio_gpu_release(struct drm_device *dev)
 {
 	struct virtio_gpu_device *vgdev = dev->dev_private;
 
+	if (!vgdev)
+		return;
+
 	virtio_gpu_modeset_fini(vgdev);
 	virtio_gpu_free_vbufs(vgdev);
 	virtio_gpu_cleanup_cap_cache(vgdev);
-- 
2.11.0


^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2021-05-18 10:09 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-17  8:49 [PATCH 1/3] drm/virtio: Fixes a potential NULL pointer dereference on probe failure Xie Yongji
2021-05-17  8:49 ` Xie Yongji
2021-05-17  8:49 ` [PATCH 2/3] drm/virtio: Fix double free " Xie Yongji
2021-05-17  8:49   ` Xie Yongji
2021-05-17  8:49 ` [PATCH 3/3] drm/virtio: free virtqueues " Xie Yongji
2021-05-17  8:49   ` Xie Yongji
2021-05-18 10:09 ` [PATCH 1/3] drm/virtio: Fixes a potential NULL pointer dereference " Gerd Hoffmann
2021-05-18 10:09   ` Gerd Hoffmann
2021-05-18 10:09   ` Gerd Hoffmann

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.