diff mbox series

drm/omap: Use after free in omap_connector_destroy()

Message ID 20181001164505.GB29248@mwanda (mailing list archive)
State New, archived
Headers show
Series drm/omap: Use after free in omap_connector_destroy() | expand

Commit Message

Dan Carpenter Oct. 1, 2018, 4:45 p.m. UTC
We can free "omap_connector" until the end of the function.

Fixes: 949ea2ef3fed ("drm/omap: Don't call HPD registration operations recursively")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Comments

Laurent Pinchart Oct. 1, 2018, 11:50 p.m. UTC | #1
Hi Dan,

Thank you for the patch.

On Monday, 1 October 2018 19:45:05 EEST Dan Carpenter wrote:
> We can free "omap_connector" until the end of the function.
> 
> Fixes: 949ea2ef3fed ("drm/omap: Don't call HPD registration operations
> recursively") Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

This has already been fixed by https://www.spinics.net/lists/dri-devel/
msg190817.html.

> 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
diff mbox series

Patch

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