All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH RESEND] drm: i915: fix a possible refcount leak in intel_dp_add_mst_connector()
@ 2022-06-24  2:28 ` Hangyu Hua
  0 siblings, 0 replies; 9+ messages in thread
From: Hangyu Hua @ 2022-06-24  2:28 UTC (permalink / raw)
  To: jani.nikula, joonas.lahtinen, rodrigo.vivi, tvrtko.ursulin,
	airlied, daniel, ville.syrjala, jose.souza, lyude,
	matthew.d.roper, anshuman.gupta, heying24, 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>
Reviewed-by: José Roberto de Souza <jose.souza@intel.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 061b277e5ce7..14d2a64193b2 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;
 	}
-- 
2.25.1


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

* [PATCH RESEND] drm: i915: fix a possible refcount leak in intel_dp_add_mst_connector()
@ 2022-06-24  2:28 ` Hangyu Hua
  0 siblings, 0 replies; 9+ messages in thread
From: Hangyu Hua @ 2022-06-24  2:28 UTC (permalink / raw)
  To: jani.nikula, joonas.lahtinen, rodrigo.vivi, tvrtko.ursulin,
	airlied, daniel, ville.syrjala, jose.souza, lyude,
	matthew.d.roper, anshuman.gupta, heying24, james.ausmus
  Cc: intel-gfx, linux-kernel, dri-devel, 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>
Reviewed-by: José Roberto de Souza <jose.souza@intel.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 061b277e5ce7..14d2a64193b2 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;
 	}
-- 
2.25.1


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

* Re: [Intel-gfx] [PATCH RESEND] drm: i915: fix a possible refcount leak in intel_dp_add_mst_connector()
  2022-06-24  2:28 ` Hangyu Hua
  (?)
@ 2022-06-24 13:07 ` Souza, Jose
  -1 siblings, 0 replies; 9+ messages in thread
From: Souza, Jose @ 2022-06-24 13:07 UTC (permalink / raw)
  To: hbh25y, intel-gfx

Hi Hangyu

Don't know why but our CI still did not caught this patch.
Maybe it is because intel-gfx@lists.freedesktop.org needs to be in the "to" list, try that in future patches.

Anyways I have resend it and it is properly behaving now.
https://patchwork.freedesktop.org/series/105601/

After CI results I will push this for you.

On Fri, 2022-06-24 at 10:28 +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.
> 
> Fixes: 091a4f91942a ("drm/i915: Handle drm-layer errors in intel_dp_add_mst_connector")
> Signed-off-by: Hangyu Hua <hbh25y@gmail.com>
> Reviewed-by: José Roberto de Souza <jose.souza@intel.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 061b277e5ce7..14d2a64193b2 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;
>  	}


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

* Re: [PATCH RESEND] drm: i915: fix a possible refcount leak in intel_dp_add_mst_connector()
  2022-06-24  2:28 ` Hangyu Hua
  (?)
@ 2022-06-28 22:55   ` Lyude Paul
  -1 siblings, 0 replies; 9+ messages in thread
From: Lyude Paul @ 2022-06-28 22:55 UTC (permalink / raw)
  To: Hangyu Hua, jani.nikula, joonas.lahtinen, rodrigo.vivi,
	tvrtko.ursulin, airlied, daniel, ville.syrjala, jose.souza,
	matthew.d.roper, anshuman.gupta, heying24, james.ausmus
  Cc: intel-gfx, dri-devel, linux-kernel

Nice catch!

Reviewed-by: Lyude Paul <lyude@redhat.com>

Will push to drm-intel-next

On Fri, 2022-06-24 at 10:28 +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.
> 
> Fixes: 091a4f91942a ("drm/i915: Handle drm-layer errors in
> intel_dp_add_mst_connector")
> Signed-off-by: Hangyu Hua <hbh25y@gmail.com>
> Reviewed-by: José Roberto de Souza <jose.souza@intel.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 061b277e5ce7..14d2a64193b2 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;
>         }

-- 
Cheers,
 Lyude Paul (she/her)
 Software Engineer at Red Hat


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

* Re: [PATCH RESEND] drm: i915: fix a possible refcount leak in intel_dp_add_mst_connector()
@ 2022-06-28 22:55   ` Lyude Paul
  0 siblings, 0 replies; 9+ messages in thread
From: Lyude Paul @ 2022-06-28 22:55 UTC (permalink / raw)
  To: Hangyu Hua, jani.nikula, joonas.lahtinen, rodrigo.vivi,
	tvrtko.ursulin, airlied, daniel, ville.syrjala, jose.souza,
	matthew.d.roper, anshuman.gupta, heying24, james.ausmus
  Cc: intel-gfx, linux-kernel, dri-devel

Nice catch!

Reviewed-by: Lyude Paul <lyude@redhat.com>

Will push to drm-intel-next

On Fri, 2022-06-24 at 10:28 +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.
> 
> Fixes: 091a4f91942a ("drm/i915: Handle drm-layer errors in
> intel_dp_add_mst_connector")
> Signed-off-by: Hangyu Hua <hbh25y@gmail.com>
> Reviewed-by: José Roberto de Souza <jose.souza@intel.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 061b277e5ce7..14d2a64193b2 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;
>         }

-- 
Cheers,
 Lyude Paul (she/her)
 Software Engineer at Red Hat


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

* Re: [Intel-gfx] [PATCH RESEND] drm: i915: fix a possible refcount leak in intel_dp_add_mst_connector()
@ 2022-06-28 22:55   ` Lyude Paul
  0 siblings, 0 replies; 9+ messages in thread
From: Lyude Paul @ 2022-06-28 22:55 UTC (permalink / raw)
  To: Hangyu Hua, jani.nikula, joonas.lahtinen, rodrigo.vivi,
	tvrtko.ursulin, airlied, daniel, ville.syrjala, jose.souza,
	matthew.d.roper, anshuman.gupta, heying24, james.ausmus
  Cc: intel-gfx, linux-kernel, dri-devel

Nice catch!

Reviewed-by: Lyude Paul <lyude@redhat.com>

Will push to drm-intel-next

On Fri, 2022-06-24 at 10:28 +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.
> 
> Fixes: 091a4f91942a ("drm/i915: Handle drm-layer errors in
> intel_dp_add_mst_connector")
> Signed-off-by: Hangyu Hua <hbh25y@gmail.com>
> Reviewed-by: José Roberto de Souza <jose.souza@intel.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 061b277e5ce7..14d2a64193b2 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;
>         }

-- 
Cheers,
 Lyude Paul (she/her)
 Software Engineer at Red Hat


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

* Re: [PATCH RESEND] drm: i915: fix a possible refcount leak in intel_dp_add_mst_connector()
  2022-06-28 22:55   ` Lyude Paul
  (?)
@ 2022-06-28 22:58     ` Lyude Paul
  -1 siblings, 0 replies; 9+ messages in thread
From: Lyude Paul @ 2022-06-28 22:58 UTC (permalink / raw)
  To: Hangyu Hua, jani.nikula, joonas.lahtinen, rodrigo.vivi,
	tvrtko.ursulin, airlied, daniel, ville.syrjala, jose.souza,
	matthew.d.roper, anshuman.gupta, heying24, james.ausmus
  Cc: intel-gfx, dri-devel, linux-kernel

Ah-nevermind! Seems like someone already pushed this for you :)

On Tue, 2022-06-28 at 18:55 -0400, Lyude Paul wrote:
> Nice catch!
> 
> Reviewed-by: Lyude Paul <lyude@redhat.com>
> 
> Will push to drm-intel-next
> 
> On Fri, 2022-06-24 at 10:28 +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.
> > 
> > Fixes: 091a4f91942a ("drm/i915: Handle drm-layer errors in
> > intel_dp_add_mst_connector")
> > Signed-off-by: Hangyu Hua <hbh25y@gmail.com>
> > Reviewed-by: José Roberto de Souza <jose.souza@intel.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 061b277e5ce7..14d2a64193b2 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;
> >         }
> 

-- 
Cheers,
 Lyude Paul (she/her)
 Software Engineer at Red Hat


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

* Re: [PATCH RESEND] drm: i915: fix a possible refcount leak in intel_dp_add_mst_connector()
@ 2022-06-28 22:58     ` Lyude Paul
  0 siblings, 0 replies; 9+ messages in thread
From: Lyude Paul @ 2022-06-28 22:58 UTC (permalink / raw)
  To: Hangyu Hua, jani.nikula, joonas.lahtinen, rodrigo.vivi,
	tvrtko.ursulin, airlied, daniel, ville.syrjala, jose.souza,
	matthew.d.roper, anshuman.gupta, heying24, james.ausmus
  Cc: intel-gfx, linux-kernel, dri-devel

Ah-nevermind! Seems like someone already pushed this for you :)

On Tue, 2022-06-28 at 18:55 -0400, Lyude Paul wrote:
> Nice catch!
> 
> Reviewed-by: Lyude Paul <lyude@redhat.com>
> 
> Will push to drm-intel-next
> 
> On Fri, 2022-06-24 at 10:28 +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.
> > 
> > Fixes: 091a4f91942a ("drm/i915: Handle drm-layer errors in
> > intel_dp_add_mst_connector")
> > Signed-off-by: Hangyu Hua <hbh25y@gmail.com>
> > Reviewed-by: José Roberto de Souza <jose.souza@intel.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 061b277e5ce7..14d2a64193b2 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;
> >         }
> 

-- 
Cheers,
 Lyude Paul (she/her)
 Software Engineer at Red Hat


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

* Re: [Intel-gfx] [PATCH RESEND] drm: i915: fix a possible refcount leak in intel_dp_add_mst_connector()
@ 2022-06-28 22:58     ` Lyude Paul
  0 siblings, 0 replies; 9+ messages in thread
From: Lyude Paul @ 2022-06-28 22:58 UTC (permalink / raw)
  To: Hangyu Hua, jani.nikula, joonas.lahtinen, rodrigo.vivi,
	tvrtko.ursulin, airlied, daniel, ville.syrjala, jose.souza,
	matthew.d.roper, anshuman.gupta, heying24, james.ausmus
  Cc: intel-gfx, linux-kernel, dri-devel

Ah-nevermind! Seems like someone already pushed this for you :)

On Tue, 2022-06-28 at 18:55 -0400, Lyude Paul wrote:
> Nice catch!
> 
> Reviewed-by: Lyude Paul <lyude@redhat.com>
> 
> Will push to drm-intel-next
> 
> On Fri, 2022-06-24 at 10:28 +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.
> > 
> > Fixes: 091a4f91942a ("drm/i915: Handle drm-layer errors in
> > intel_dp_add_mst_connector")
> > Signed-off-by: Hangyu Hua <hbh25y@gmail.com>
> > Reviewed-by: José Roberto de Souza <jose.souza@intel.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 061b277e5ce7..14d2a64193b2 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;
> >         }
> 

-- 
Cheers,
 Lyude Paul (she/her)
 Software Engineer at Red Hat


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

end of thread, other threads:[~2022-06-28 22:58 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-24  2:28 [PATCH RESEND] drm: i915: fix a possible refcount leak in intel_dp_add_mst_connector() Hangyu Hua
2022-06-24  2:28 ` Hangyu Hua
2022-06-24 13:07 ` [Intel-gfx] " Souza, Jose
2022-06-28 22:55 ` Lyude Paul
2022-06-28 22:55   ` [Intel-gfx] " Lyude Paul
2022-06-28 22:55   ` Lyude Paul
2022-06-28 22:58   ` Lyude Paul
2022-06-28 22:58     ` [Intel-gfx] " Lyude Paul
2022-06-28 22:58     ` Lyude Paul

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.