* [PATCH] drm/virtio: Remove incorrect kfree()
@ 2019-01-02 17:55 Ezequiel Garcia
2019-01-02 17:55 ` [PATCH] drm/virtio: Add missing virtqueue reset Ezequiel Garcia
2019-01-08 10:40 ` [PATCH] drm/virtio: Remove incorrect kfree() Gerd Hoffmann
0 siblings, 2 replies; 3+ messages in thread
From: Ezequiel Garcia @ 2019-01-02 17:55 UTC (permalink / raw)
To: dri-devel, virtualization; +Cc: David Airlie, Ezequiel Garcia, Gerd Hoffmann
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.
Signed-off-by: Ezequiel Garcia <ezequiel@collabora.com>
---
drivers/gpu/drm/virtio/virtgpu_display.c | 4 ----
1 file changed, 4 deletions(-)
diff --git a/drivers/gpu/drm/virtio/virtgpu_display.c b/drivers/gpu/drm/virtio/virtgpu_display.c
index e1c223e18d86..d539bc28dc97 100644
--- a/drivers/gpu/drm/virtio/virtgpu_display.c
+++ b/drivers/gpu/drm/virtio/virtgpu_display.c
@@ -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 = {
--
2.20.0
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply related [flat|nested] 3+ messages in thread* [PATCH] drm/virtio: Add missing virtqueue reset
2019-01-02 17:55 [PATCH] drm/virtio: Remove incorrect kfree() Ezequiel Garcia
@ 2019-01-02 17:55 ` Ezequiel Garcia
2019-01-08 10:40 ` [PATCH] drm/virtio: Remove incorrect kfree() Gerd Hoffmann
1 sibling, 0 replies; 3+ messages in thread
From: Ezequiel Garcia @ 2019-01-02 17:55 UTC (permalink / raw)
To: dri-devel, virtualization; +Cc: David Airlie, Ezequiel Garcia, Gerd Hoffmann
As per the VirtIO spec, the virtqueues must be reset during cleanup
(see "3.3.1 Driver Requirements: Device Cleanup").
Signed-off-by: Ezequiel Garcia <ezequiel@collabora.com>
---
drivers/gpu/drm/virtio/virtgpu_kms.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/gpu/drm/virtio/virtgpu_kms.c b/drivers/gpu/drm/virtio/virtgpu_kms.c
index 1072064a0db2..c340be252fce 100644
--- a/drivers/gpu/drm/virtio/virtgpu_kms.c
+++ b/drivers/gpu/drm/virtio/virtgpu_kms.c
@@ -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);
--
2.20.0
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] drm/virtio: Remove incorrect kfree()
2019-01-02 17:55 [PATCH] drm/virtio: Remove incorrect kfree() Ezequiel Garcia
2019-01-02 17:55 ` [PATCH] drm/virtio: Add missing virtqueue reset Ezequiel Garcia
@ 2019-01-08 10:40 ` Gerd Hoffmann
1 sibling, 0 replies; 3+ messages in thread
From: Gerd Hoffmann @ 2019-01-08 10:40 UTC (permalink / raw)
To: Ezequiel Garcia; +Cc: David Airlie, dri-devel, virtualization
On Wed, Jan 02, 2019 at 02:55:06PM -0300, Ezequiel Garcia wrote:
> 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.
>
> Signed-off-by: Ezequiel Garcia <ezequiel@collabora.com>
Both patches are queued up.
thanks,
Gerd
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-01-08 10:40 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-01-02 17:55 [PATCH] drm/virtio: Remove incorrect kfree() Ezequiel Garcia
2019-01-02 17:55 ` [PATCH] drm/virtio: Add missing virtqueue reset Ezequiel Garcia
2019-01-08 10:40 ` [PATCH] drm/virtio: Remove incorrect kfree() Gerd Hoffmann
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox