diff mbox series

drm/virtio: Remove incorrect kfree()

Message ID 20190102175507.4653-1-ezequiel@collabora.com (mailing list archive)
State New, archived
Headers show
Series drm/virtio: Remove incorrect kfree() | expand

Commit Message

Ezequiel Garcia Jan. 2, 2019, 5:55 p.m. UTC
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(-)

Comments

Gerd Hoffmann Jan. 8, 2019, 10:40 a.m. UTC | #1
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
diff mbox series

Patch

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 = {