dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/omap: fix use of freed memory
@ 2018-09-26 10:05 Tomi Valkeinen
  2018-09-26 13:09 ` Laurent Pinchart
  0 siblings, 1 reply; 2+ messages in thread
From: Tomi Valkeinen @ 2018-09-26 10:05 UTC (permalink / raw)
  To: Laurent Pinchart, dri-devel; +Cc: Tomi Valkeinen

omap_connector_destroy() does:

kfree(omap_connector);
omapdss_device_put(omap_connector->output);
omapdss_device_put(omap_connector->display);

Fix this by moving the kfree after the omapdss_device_puts.

This bug was introduced in 949ea2ef3fed4e1d0f9b80ec21ed81a9833ac248

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
 drivers/gpu/drm/omapdrm/omap_connector.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/omapdrm/omap_connector.c b/drivers/gpu/drm/omapdrm/omap_connector.c
index 98f5ca29444a..b81302c4bf9e 100644
--- a/drivers/gpu/drm/omapdrm/omap_connector.c
+++ b/drivers/gpu/drm/omapdrm/omap_connector.c
@@ -164,10 +164,11 @@ static void omap_connector_destroy(struct drm_connector *connector)
 
 	drm_connector_unregister(connector);
 	drm_connector_cleanup(connector);
-	kfree(omap_connector);
 
 	omapdss_device_put(omap_connector->output);
 	omapdss_device_put(omap_connector->display);
+
+	kfree(omap_connector);
 }
 
 #define MAX_EDID  512
-- 
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH] drm/omap: fix use of freed memory
  2018-09-26 10:05 [PATCH] drm/omap: fix use of freed memory Tomi Valkeinen
@ 2018-09-26 13:09 ` Laurent Pinchart
  0 siblings, 0 replies; 2+ messages in thread
From: Laurent Pinchart @ 2018-09-26 13:09 UTC (permalink / raw)
  To: Tomi Valkeinen; +Cc: dri-devel

Hi Tomi,

Thank you for the patch.

On Wednesday, 26 September 2018 13:05:59 EEST Tomi Valkeinen wrote:
> omap_connector_destroy() does:
> 
> kfree(omap_connector);
> omapdss_device_put(omap_connector->output);
> omapdss_device_put(omap_connector->display);
> 
> Fix this by moving the kfree after the omapdss_device_puts.
> 
> This bug was introduced in 949ea2ef3fed4e1d0f9b80ec21ed81a9833ac248
> 
> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

Sorry for introducing the bug in the first place.

> ---
>  drivers/gpu/drm/omapdrm/omap_connector.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/omap_connector.c
> b/drivers/gpu/drm/omapdrm/omap_connector.c index 98f5ca29444a..b81302c4bf9e
> 100644
> --- a/drivers/gpu/drm/omapdrm/omap_connector.c
> +++ b/drivers/gpu/drm/omapdrm/omap_connector.c
> @@ -164,10 +164,11 @@ static void omap_connector_destroy(struct
> drm_connector *connector)
> 
>  	drm_connector_unregister(connector);
>  	drm_connector_cleanup(connector);
> -	kfree(omap_connector);
> 
>  	omapdss_device_put(omap_connector->output);
>  	omapdss_device_put(omap_connector->display);
> +
> +	kfree(omap_connector);
>  }
> 
>  #define MAX_EDID  512

-- 
Regards,

Laurent Pinchart



_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

end of thread, other threads:[~2018-09-26 13:08 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-09-26 10:05 [PATCH] drm/omap: fix use of freed memory Tomi Valkeinen
2018-09-26 13:09 ` Laurent Pinchart

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox