kernel-janitors.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] remoteproc: imx_rproc: Fix a resource leak in the remove function
@ 2021-10-16  6:44 Christophe JAILLET
  2021-10-21 17:41 ` Mathieu Poirier
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Christophe JAILLET @ 2021-10-16  6:44 UTC (permalink / raw)
  To: ohad, bjorn.andersson, mathieu.poirier, shawnguo, s.hauer,
	kernel, festevam, linux-imx, hongxing.zhu, peng.fan
  Cc: linux-remoteproc, linux-arm-kernel, linux-kernel,
	kernel-janitors, Christophe JAILLET

'priv->workqueue' is destroyed in the error handling path of the probe but
not in the remove function.

Add the missing call to release some resources.

Fixes: 2df7062002d0 ("remoteproc: imx_proc: enable virtio/mailbox")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
This patch is speculative. I'm not sure if the added function call is at
the right place in the remove function.
Review with care.
---
 drivers/remoteproc/imx_rproc.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/remoteproc/imx_rproc.c b/drivers/remoteproc/imx_rproc.c
index ff8170dbbc3c..0a45bc0d3f73 100644
--- a/drivers/remoteproc/imx_rproc.c
+++ b/drivers/remoteproc/imx_rproc.c
@@ -804,6 +804,7 @@ static int imx_rproc_remove(struct platform_device *pdev)
 	clk_disable_unprepare(priv->clk);
 	rproc_del(rproc);
 	imx_rproc_free_mbox(rproc);
+	destroy_workqueue(priv->workqueue);
 	rproc_free(rproc);
 
 	return 0;
-- 
2.30.2


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

* Re: [PATCH] remoteproc: imx_rproc: Fix a resource leak in the remove function
  2021-10-16  6:44 [PATCH] remoteproc: imx_rproc: Fix a resource leak in the remove function Christophe JAILLET
@ 2021-10-21 17:41 ` Mathieu Poirier
  2021-11-10  8:53   ` Peng Fan
  2021-11-10  8:45 ` Peng Fan
  2021-11-10  8:54 ` Peng Fan
  2 siblings, 1 reply; 6+ messages in thread
From: Mathieu Poirier @ 2021-10-21 17:41 UTC (permalink / raw)
  To: Christophe JAILLET
  Cc: ohad, bjorn.andersson, shawnguo, s.hauer, kernel, festevam,
	linux-imx, hongxing.zhu, peng.fan, linux-remoteproc,
	linux-arm-kernel, linux-kernel, kernel-janitors

On Sat, Oct 16, 2021 at 08:44:28AM +0200, Christophe JAILLET wrote:
> 'priv->workqueue' is destroyed in the error handling path of the probe but
> not in the remove function.
> 
> Add the missing call to release some resources.
> 
> Fixes: 2df7062002d0 ("remoteproc: imx_proc: enable virtio/mailbox")
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> ---
> This patch is speculative. I'm not sure if the added function call is at
> the right place in the remove function.
> Review with care.
> ---
>  drivers/remoteproc/imx_rproc.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/remoteproc/imx_rproc.c b/drivers/remoteproc/imx_rproc.c
> index ff8170dbbc3c..0a45bc0d3f73 100644
> --- a/drivers/remoteproc/imx_rproc.c
> +++ b/drivers/remoteproc/imx_rproc.c
> @@ -804,6 +804,7 @@ static int imx_rproc_remove(struct platform_device *pdev)
>  	clk_disable_unprepare(priv->clk);
>  	rproc_del(rproc);
>  	imx_rproc_free_mbox(rproc);
> +	destroy_workqueue(priv->workqueue);

This seems to be the right thing to do. Peng - please review and test on your
side.

Thanks,
Mathieu

>  	rproc_free(rproc);
>  
>  	return 0;
> -- 
> 2.30.2
> 

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

* RE: [PATCH] remoteproc: imx_rproc: Fix a resource leak in the remove function
  2021-10-16  6:44 [PATCH] remoteproc: imx_rproc: Fix a resource leak in the remove function Christophe JAILLET
  2021-10-21 17:41 ` Mathieu Poirier
@ 2021-11-10  8:45 ` Peng Fan
  2021-11-10  8:54 ` Peng Fan
  2 siblings, 0 replies; 6+ messages in thread
From: Peng Fan @ 2021-11-10  8:45 UTC (permalink / raw)
  To: Christophe JAILLET, ohad, bjorn.andersson, mathieu.poirier,
	shawnguo, s.hauer, kernel, festevam, dl-linux-imx, Hongxing Zhu
  Cc: linux-remoteproc, linux-arm-kernel, linux-kernel, kernel-janitors

> Subject: [PATCH] remoteproc: imx_rproc: Fix a resource leak in the remove
> function
> 
> 'priv->workqueue' is destroyed in the error handling path of the probe but not
> in the remove function.
> 
> Add the missing call to release some resources.
> 
> Fixes: 2df7062002d0 ("remoteproc: imx_proc: enable virtio/mailbox")
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>


Tested-by: Peng Fan <peng.fan@nxp.com>

> ---
> This patch is speculative. I'm not sure if the added function call is at the right
> place in the remove function.
> Review with care.
> ---
>  drivers/remoteproc/imx_rproc.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/remoteproc/imx_rproc.c
> b/drivers/remoteproc/imx_rproc.c index ff8170dbbc3c..0a45bc0d3f73
> 100644
> --- a/drivers/remoteproc/imx_rproc.c
> +++ b/drivers/remoteproc/imx_rproc.c
> @@ -804,6 +804,7 @@ static int imx_rproc_remove(struct platform_device
> *pdev)
>  	clk_disable_unprepare(priv->clk);
>  	rproc_del(rproc);
>  	imx_rproc_free_mbox(rproc);
> +	destroy_workqueue(priv->workqueue);
>  	rproc_free(rproc);
> 
>  	return 0;
> --
> 2.30.2


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

* RE: [PATCH] remoteproc: imx_rproc: Fix a resource leak in the remove function
  2021-10-21 17:41 ` Mathieu Poirier
@ 2021-11-10  8:53   ` Peng Fan
  0 siblings, 0 replies; 6+ messages in thread
From: Peng Fan @ 2021-11-10  8:53 UTC (permalink / raw)
  To: Mathieu Poirier, Christophe JAILLET
  Cc: ohad, bjorn.andersson, shawnguo, s.hauer, kernel, festevam,
	dl-linux-imx, Hongxing Zhu, linux-remoteproc, linux-arm-kernel,
	linux-kernel, kernel-janitors

> Subject: Re: [PATCH] remoteproc: imx_rproc: Fix a resource leak in the
> remove function
> 
> On Sat, Oct 16, 2021 at 08:44:28AM +0200, Christophe JAILLET wrote:
> > 'priv->workqueue' is destroyed in the error handling path of the probe
> > but not in the remove function.
> >
> > Add the missing call to release some resources.
> >
> > Fixes: 2df7062002d0 ("remoteproc: imx_proc: enable virtio/mailbox")
> > Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> > ---
> > This patch is speculative. I'm not sure if the added function call is
> > at the right place in the remove function.
> > Review with care.
> > ---
> >  drivers/remoteproc/imx_rproc.c | 1 +
> >  1 file changed, 1 insertion(+)
> >
> > diff --git a/drivers/remoteproc/imx_rproc.c
> > b/drivers/remoteproc/imx_rproc.c index ff8170dbbc3c..0a45bc0d3f73
> > 100644
> > --- a/drivers/remoteproc/imx_rproc.c
> > +++ b/drivers/remoteproc/imx_rproc.c
> > @@ -804,6 +804,7 @@ static int imx_rproc_remove(struct platform_device
> *pdev)
> >  	clk_disable_unprepare(priv->clk);
> >  	rproc_del(rproc);
> >  	imx_rproc_free_mbox(rproc);
> > +	destroy_workqueue(priv->workqueue);
> 
> This seems to be the right thing to do. Peng - please review and test on your
> side.

Sorry for late reply, I built the driver as a module with this patch. And no issue found.

THnaks,
Peng.

> 
> Thanks,
> Mathieu
> 
> >  	rproc_free(rproc);
> >
> >  	return 0;
> > --
> > 2.30.2
> >

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

* RE: [PATCH] remoteproc: imx_rproc: Fix a resource leak in the remove function
  2021-10-16  6:44 [PATCH] remoteproc: imx_rproc: Fix a resource leak in the remove function Christophe JAILLET
  2021-10-21 17:41 ` Mathieu Poirier
  2021-11-10  8:45 ` Peng Fan
@ 2021-11-10  8:54 ` Peng Fan
  2021-11-11 18:20   ` Mathieu Poirier
  2 siblings, 1 reply; 6+ messages in thread
From: Peng Fan @ 2021-11-10  8:54 UTC (permalink / raw)
  To: Christophe JAILLET, ohad, bjorn.andersson, mathieu.poirier,
	shawnguo, s.hauer, kernel, festevam, dl-linux-imx, Hongxing Zhu
  Cc: linux-remoteproc, linux-arm-kernel, linux-kernel, kernel-janitors

> Subject: [PATCH] remoteproc: imx_rproc: Fix a resource leak in the remove
> function
> 
> 'priv->workqueue' is destroyed in the error handling path of the probe but not
> in the remove function.
> 
> Add the missing call to release some resources.
> 
> Fixes: 2df7062002d0 ("remoteproc: imx_proc: enable virtio/mailbox")
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>

Reviewed-and-Tested-by: Peng Fan <peng.fan@nxp.com>

> ---
> This patch is speculative. I'm not sure if the added function call is at the right
> place in the remove function.
> Review with care.
> ---
>  drivers/remoteproc/imx_rproc.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/remoteproc/imx_rproc.c
> b/drivers/remoteproc/imx_rproc.c index ff8170dbbc3c..0a45bc0d3f73
> 100644
> --- a/drivers/remoteproc/imx_rproc.c
> +++ b/drivers/remoteproc/imx_rproc.c
> @@ -804,6 +804,7 @@ static int imx_rproc_remove(struct platform_device
> *pdev)
>  	clk_disable_unprepare(priv->clk);
>  	rproc_del(rproc);
>  	imx_rproc_free_mbox(rproc);
> +	destroy_workqueue(priv->workqueue);
>  	rproc_free(rproc);
> 
>  	return 0;
> --
> 2.30.2


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

* Re: [PATCH] remoteproc: imx_rproc: Fix a resource leak in the remove function
  2021-11-10  8:54 ` Peng Fan
@ 2021-11-11 18:20   ` Mathieu Poirier
  0 siblings, 0 replies; 6+ messages in thread
From: Mathieu Poirier @ 2021-11-11 18:20 UTC (permalink / raw)
  To: Peng Fan
  Cc: Christophe JAILLET, ohad, bjorn.andersson, shawnguo, s.hauer,
	kernel, festevam, dl-linux-imx, Hongxing Zhu, linux-remoteproc,
	linux-arm-kernel, linux-kernel, kernel-janitors

On Wed, 10 Nov 2021 at 01:54, Peng Fan <peng.fan@nxp.com> wrote:
>
> > Subject: [PATCH] remoteproc: imx_rproc: Fix a resource leak in the remove
> > function
> >
> > 'priv->workqueue' is destroyed in the error handling path of the probe but not
> > in the remove function.
> >
> > Add the missing call to release some resources.
> >
> > Fixes: 2df7062002d0 ("remoteproc: imx_proc: enable virtio/mailbox")
> > Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
>
> Reviewed-and-Tested-by: Peng Fan <peng.fan@nxp.com>
>

Thank you for that - I will pick up this patch when -rc1 or -rc2 gets released.

Thanks,
Mathieu

> > ---
> > This patch is speculative. I'm not sure if the added function call is at the right
> > place in the remove function.
> > Review with care.
> > ---
> >  drivers/remoteproc/imx_rproc.c | 1 +
> >  1 file changed, 1 insertion(+)
> >
> > diff --git a/drivers/remoteproc/imx_rproc.c
> > b/drivers/remoteproc/imx_rproc.c index ff8170dbbc3c..0a45bc0d3f73
> > 100644
> > --- a/drivers/remoteproc/imx_rproc.c
> > +++ b/drivers/remoteproc/imx_rproc.c
> > @@ -804,6 +804,7 @@ static int imx_rproc_remove(struct platform_device
> > *pdev)
> >       clk_disable_unprepare(priv->clk);
> >       rproc_del(rproc);
> >       imx_rproc_free_mbox(rproc);
> > +     destroy_workqueue(priv->workqueue);
> >       rproc_free(rproc);
> >
> >       return 0;
> > --
> > 2.30.2
>

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

end of thread, other threads:[~2021-11-11 18:20 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-16  6:44 [PATCH] remoteproc: imx_rproc: Fix a resource leak in the remove function Christophe JAILLET
2021-10-21 17:41 ` Mathieu Poirier
2021-11-10  8:53   ` Peng Fan
2021-11-10  8:45 ` Peng Fan
2021-11-10  8:54 ` Peng Fan
2021-11-11 18:20   ` Mathieu Poirier

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).