[Intel-gfx] [PATCH] drm: i915: fix a possible refcount leak in intel_dp_add_mst_connector()

Andrzej Hajda andrzej.hajda at intel.com
Thu Jun 30 14:46:33 UTC 2022


On 24.06.2022 15:04, José Roberto de Souza wrote:
> From: Hangyu Hua <hbh25y at gmail.com>
> 
> If drm_connector_init fails, intel_connector_free will be called to take
> care of proper free. So it is necessary to drop the refcount of port
> before intel_connector_free.
> 
> Fixes: 091a4f91942a ("drm/i915: Handle drm-layer errors in intel_dp_add_mst_connector")
> Signed-off-by: Hangyu Hua <hbh25y at gmail.com>
> Reviewed-by: José Roberto de Souza <jose.souza at intel.com>


Reviewed-by: Andrzej Hajda <andrzej.hajda at intel.com>

Regards
Andrzej

> ---
>   drivers/gpu/drm/i915/display/intel_dp_mst.c | 1 +
>   1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/gpu/drm/i915/display/intel_dp_mst.c b/drivers/gpu/drm/i915/display/intel_dp_mst.c
> index 061b277e5ce78..14d2a64193b2d 100644
> --- a/drivers/gpu/drm/i915/display/intel_dp_mst.c
> +++ b/drivers/gpu/drm/i915/display/intel_dp_mst.c
> @@ -839,6 +839,7 @@ static struct drm_connector *intel_dp_add_mst_connector(struct drm_dp_mst_topolo
>   	ret = drm_connector_init(dev, connector, &intel_dp_mst_connector_funcs,
>   				 DRM_MODE_CONNECTOR_DisplayPort);
>   	if (ret) {
> +		drm_dp_mst_put_port_malloc(port);
>   		intel_connector_free(intel_connector);
>   		return NULL;
>   	}



More information about the Intel-gfx mailing list