linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] drm: i915: fix a possible refcount leak in intel_dp_add_mst_connector()
@ 2022-05-16  7:19 Hangyu Hua
  2022-06-23  2:18 ` Hangyu Hua
  2022-06-23 13:44 ` Souza, Jose
  0 siblings, 2 replies; 3+ messages in thread
From: Hangyu Hua @ 2022-05-16  7:19 UTC (permalink / raw)
  To: jani.nikula, joonas.lahtinen, rodrigo.vivi, tvrtko.ursulin,
	airlied, daniel, ville.syrjala, jose.souza, Bhawanpreet.Lakha,
	matthew.d.roper, heying24, anshuman.gupta, james.ausmus
  Cc: intel-gfx, dri-devel, linux-kernel, Hangyu Hua

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@gmail.com>
---
 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 e30e698aa684..f7d46ea3afb9 100644
--- a/drivers/gpu/drm/i915/display/intel_dp_mst.c
+++ b/drivers/gpu/drm/i915/display/intel_dp_mst.c
@@ -841,6 +841,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;
 	}
-- 
2.25.1


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

* Re: [PATCH] drm: i915: fix a possible refcount leak in intel_dp_add_mst_connector()
  2022-05-16  7:19 [PATCH] drm: i915: fix a possible refcount leak in intel_dp_add_mst_connector() Hangyu Hua
@ 2022-06-23  2:18 ` Hangyu Hua
  2022-06-23 13:44 ` Souza, Jose
  1 sibling, 0 replies; 3+ messages in thread
From: Hangyu Hua @ 2022-06-23  2:18 UTC (permalink / raw)
  To: jani.nikula, joonas.lahtinen, rodrigo.vivi, tvrtko.ursulin,
	airlied, daniel, ville.syrjala, jose.souza, Bhawanpreet.Lakha,
	matthew.d.roper, heying24, anshuman.gupta, james.ausmus
  Cc: intel-gfx, dri-devel, linux-kernel

On 2022/5/16 15:19, Hangyu Hua wrote:
> 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@gmail.com>
> ---
>   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 e30e698aa684..f7d46ea3afb9 100644
> --- a/drivers/gpu/drm/i915/display/intel_dp_mst.c
> +++ b/drivers/gpu/drm/i915/display/intel_dp_mst.c
> @@ -841,6 +841,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;
>   	}

Gentel ping.

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

* Re: [PATCH] drm: i915: fix a possible refcount leak in intel_dp_add_mst_connector()
  2022-05-16  7:19 [PATCH] drm: i915: fix a possible refcount leak in intel_dp_add_mst_connector() Hangyu Hua
  2022-06-23  2:18 ` Hangyu Hua
@ 2022-06-23 13:44 ` Souza, Jose
  1 sibling, 0 replies; 3+ messages in thread
From: Souza, Jose @ 2022-06-23 13:44 UTC (permalink / raw)
  To: hbh25y; +Cc: dri-devel, intel-gfx, linux-kernel

On Mon, 2022-05-16 at 15:19 +0800, Hangyu Hua wrote:
> 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.

Reviewed-by: José Roberto de Souza <jose.souza@intel.com>

> 
> Fixes: 091a4f91942a ("drm/i915: Handle drm-layer errors in intel_dp_add_mst_connector")
> Signed-off-by: Hangyu Hua <hbh25y@gmail.com>
> ---
>  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 e30e698aa684..f7d46ea3afb9 100644
> --- a/drivers/gpu/drm/i915/display/intel_dp_mst.c
> +++ b/drivers/gpu/drm/i915/display/intel_dp_mst.c
> @@ -841,6 +841,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;
>  	}


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

end of thread, other threads:[~2022-06-23 13:44 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-16  7:19 [PATCH] drm: i915: fix a possible refcount leak in intel_dp_add_mst_connector() Hangyu Hua
2022-06-23  2:18 ` Hangyu Hua
2022-06-23 13:44 ` Souza, Jose

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).