drm/virtio: Remove incorrect kfree()
Subsystems (4)
PATCH 1/1 drm/virtio: Remove incorrect kfree()
The virtio_gpu_output is a member of struct virtio_gpu_device and is not a dynamically-allocated chunk, so it's wrong to kfree() it. Removing it fixes a memory corruption BUG() that can be triggered when the virtio-gpu driver is removed.
--- drivers/gpu/drm/virtio/virtgpu_display.c | 4 ---- 1 file changed, 4 deletions(-)
drivers/gpu/drm/virtio/virtgpu_display.c +0 -4
@@ -243,12 +243,8 @@ static enum drm_connector_status virtio_gpu_conn_detect(static void virtio_gpu_conn_destroy (struct drm_connector *connector) { -struct virtio_gpu_output *virtio_gpu_output = -drm_connector_to_virtio_gpu_output (connector); -drm_connector_unregister (connector);drm_connector_cleanup (connector); -kfree (virtio_gpu_output); }static const struct drm_connector_funcs virtio_gpu_connector_funcs = {
Signature · 6 lines
2.20.0 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 1/1 drm/virtio: Add missing virtqueue reset
As per the VirtIO spec, the virtqueues must be reset during cleanup (see "3.3.1 Driver Requirements: Device Cleanup").
--- drivers/gpu/drm/virtio/virtgpu_kms.c | 1 + 1 file changed, 1 insertion(+)
drivers/gpu/drm/virtio/virtgpu_kms.c +1 -0
@@ -239,6 +239,7 @@ void virtio_gpu_driver_unload(struct drm_device *dev)flush_work (&vgdev->ctrlq.dequeue_work);flush_work (&vgdev->cursorq.dequeue_work);flush_work (&vgdev->config_changed_work); + vgdev->vdev->config->reset (vgdev->vdev); vgdev->vdev->config->del_vqs (vgdev->vdev);virtio_gpu_modeset_fini (vgdev);
Signature · 6 lines
2.20.0 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Gerd Hoffmann
maintainerQuoted 6 lines · Ezequiel Garcia
The
virtio_gpu_outputis a member of structvirtio_gpu_deviceand is not a dynamically-allocated chunk, so it's wrong tokfree()it. Removing it fixes a memory corruptionBUG()that can be triggered when the virtio-gpu driver is removed.Signed-off-by Ezequiel Garcia <[email protected]>
Both patches are queued up.
thanks,
Gerd
Gerd Hoffmann
maintainerQuoted 6 lines · Ezequiel Garcia
The
virtio_gpu_outputis a member of structvirtio_gpu_deviceand is not a dynamically-allocated chunk, so it's wrong tokfree()it. Removing it fixes a memory corruptionBUG()that can be triggered when the virtio-gpu driver is removed.Signed-off-by Ezequiel Garcia <[email protected]>
Both patches are queued up.
thanks,
Gerd
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel