diff mbox series

[4/4] drm/virtio: Fix connector leak during virtio-gpu deinitialization.

Message ID 20180720141143.15469-5-damir.shaikhutdinov@opensynergy.com (mailing list archive)
State New, archived
Headers show
Series Fix virtio-gpu deinitialization paths. | expand

Commit Message

Damir Shaikhutdinov July 20, 2018, 2:11 p.m. UTC
Attaching CRTC to a connector increases its reference count, preventing
it from correct deinitialization. Following kernel log is printed when
the leak is found:

	Console: switching to colour VGA+ 80x25
	WARNING: at drivers/gpu/drm/drm_mode_config.c:431
	...
	Call Trace:
	 drm_mode_config_cleanup
	 virtio_gpu_modeset_fini
	 virtio_gpu_driver_unload
	 drm_dev_unregister
	 drm_put_dev
	 virtio_gpu_remove
	 virtio_dev_remove
	 device_release_driver_internal
	 device_release_driver
	 bus_remove_device
	 device_del
	 device_unregister
	 unregister_virtio_device
	...
	[drm:drm_mode_config_cleanup] ERROR connector Virtual-1 leaked!

Calling drm_atomic_helper_shutdown disconnects CRTCs from connectors,
allowing them to be freed during drm_mode_config_cleanup.

Signed-off-by: Damir Shaikhutdinov <damir.shaikhutdinov@opensynergy.com>
Signed-off-by: Kiran Pawar <kiran.pawar@opensynergy.com>
---
 drivers/gpu/drm/virtio/virtgpu_display.c | 1 +
 1 file changed, 1 insertion(+)
diff mbox series

Patch

diff --git a/drivers/gpu/drm/virtio/virtgpu_display.c b/drivers/gpu/drm/virtio/virtgpu_display.c
index d314e3c672f2..088a751a35e9 100644
--- a/drivers/gpu/drm/virtio/virtgpu_display.c
+++ b/drivers/gpu/drm/virtio/virtgpu_display.c
@@ -377,5 +377,6 @@  int virtio_gpu_modeset_init(struct virtio_gpu_device *vgdev)
 
 void virtio_gpu_modeset_fini(struct virtio_gpu_device *vgdev)
 {
+	drm_atomic_helper_shutdown(vgdev->ddev);
 	drm_mode_config_cleanup(vgdev->ddev);
 }