mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] EDAC/versalnet: fix remoteproc reference leak
@ 2026-09-13  5:35 Guangshuo Li
  2026-09-23 11:40 ` Pandey, Radhey Shyam
  0 siblings, 1 reply; 3+ messages in thread
From: Guangshuo Li @ 2026-09-13  5:35 UTC (permalink / raw)
  To: Shubhrajyoti Datta, Borislav Petkov, Tony Luck, linux-edac, linux-kernel
  Cc: Guangshuo Li, stable

mc_probe() acquires a reference to the remote processor with
rproc_get_by_phandle(), but mc_remove() does not release the reference.

rproc_shutdown() only balances the power reference acquired by
rproc_boot(); it does not drop the device reference acquired by
rproc_get_by_phandle(). As a result, successful driver removal leaves
the remoteproc reference unbalanced.

Call rproc_put() during removal to release the reference acquired in
mc_probe().

This issue was found by manual code inspection.

Fixes: d5fe2fec6c40d ("EDAC: Add a driver for the AMD Versal NET DDR controller")
Cc: stable@vger.kernel.org
Signed-off-by: Guangshuo Li <lgs201920130244@gmail.com>
---
 drivers/edac/versalnet_edac.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/edac/versalnet_edac.c b/drivers/edac/versalnet_edac.c
index 97ec05d68bbb..3a06b41c1d84 100644
--- a/drivers/edac/versalnet_edac.c
+++ b/drivers/edac/versalnet_edac.c
@@ -953,6 +953,7 @@ static void mc_remove(struct platform_device *pdev)
 	remove_versalnet(priv);
 	rproc_shutdown(priv->mcdi->r5_rproc);
 	cdx_mcdi_finish(priv->mcdi);
+	rproc_put(priv->mcdi->r5_rproc);
 	kfree(priv->mcdi);
 }
 
-- 
2.43.0


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

* Re: [PATCH] EDAC/versalnet: fix remoteproc reference leak
  2026-09-13  5:35 [PATCH] EDAC/versalnet: fix remoteproc reference leak Guangshuo Li
@ 2026-09-23 11:40 ` Pandey, Radhey Shyam
  2026-09-27 21:17   ` Borislav Petkov
  0 siblings, 1 reply; 3+ messages in thread
From: Pandey, Radhey Shyam @ 2026-09-23 11:40 UTC (permalink / raw)
  To: Guangshuo Li, Shubhrajyoti Datta, Borislav Petkov, Tony Luck,
	linux-edac, linux-kernel
  Cc: stable

On 9/13/2026 11:05 AM, Guangshuo Li wrote:

Nit - EDAC/versalnet: Fix remoteproc reference leak in mc_remove()> 
mc_probe() acquires a reference to the remote processor with
> rproc_get_by_phandle(), but mc_remove() does not release the reference.
> 
> rproc_shutdown() only balances the power reference acquired by
> rproc_boot(); it does not drop the device reference acquired by
> rproc_get_by_phandle(). As a result, successful driver removal leaves
> the remoteproc reference unbalanced.
> 
> Call rproc_put() during removal to release the reference acquired in
> mc_probe().
> 
> This issue was found by manual code inspection.
> 
> Fixes: d5fe2fec6c40d ("EDAC: Add a driver for the AMD Versal NET DDR controller")
> Cc: stable@vger.kernel.org
> Signed-off-by: Guangshuo Li <lgs201920130244@gmail.com>

Reviewed-by: Radhey Shyam Pandey <radhey.shyam.pandey@amd.com>
Thanks!> ---
>   drivers/edac/versalnet_edac.c | 1 +
>   1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/edac/versalnet_edac.c b/drivers/edac/versalnet_edac.c
> index 97ec05d68bbb..3a06b41c1d84 100644
> --- a/drivers/edac/versalnet_edac.c
> +++ b/drivers/edac/versalnet_edac.c
> @@ -953,6 +953,7 @@ static void mc_remove(struct platform_device *pdev)
>   	remove_versalnet(priv);
>   	rproc_shutdown(priv->mcdi->r5_rproc);
>   	cdx_mcdi_finish(priv->mcdi);
> +	rproc_put(priv->mcdi->r5_rproc);
>   	kfree(priv->mcdi);
>   }
>   


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

* Re: [PATCH] EDAC/versalnet: fix remoteproc reference leak
  2026-09-23 11:40 ` Pandey, Radhey Shyam
@ 2026-09-27 21:17   ` Borislav Petkov
  0 siblings, 0 replies; 3+ messages in thread
From: Borislav Petkov @ 2026-09-27 21:17 UTC (permalink / raw)
  To: Pandey, Radhey Shyam
  Cc: Guangshuo Li, Shubhrajyoti Datta, Tony Luck, linux-edac,
	linux-kernel, stable

On Wed, Sep 23, 2026 at 05:10:26PM +0530, Pandey, Radhey Shyam wrote:
> On 9/13/2026 11:05 AM, Guangshuo Li wrote:
> 
> Nit - EDAC/versalnet: Fix remoteproc reference leak in mc_remove()>
> mc_probe() acquires a reference to the remote processor with
> > rproc_get_by_phandle(), but mc_remove() does not release the reference.
> > 
> > rproc_shutdown() only balances the power reference acquired by
> > rproc_boot(); it does not drop the device reference acquired by
> > rproc_get_by_phandle(). As a result, successful driver removal leaves
> > the remoteproc reference unbalanced.
> > 
> > Call rproc_put() during removal to release the reference acquired in
> > mc_probe().
> > 
> > This issue was found by manual code inspection.
> > 
> > Fixes: d5fe2fec6c40d ("EDAC: Add a driver for the AMD Versal NET DDR controller")
> > Cc: stable@vger.kernel.org
> > Signed-off-by: Guangshuo Li <lgs201920130244@gmail.com>
> 
> Reviewed-by: Radhey Shyam Pandey <radhey.shyam.pandey@amd.com>
> Thanks!> ---

Applied, thanks.

-- 
Regards/Gruss,
    Boris.

https://people.kernel.org/tglx/notes-about-netiquette

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

end of thread, other threads:[~2026-09-27 21:18 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-13  5:35 [PATCH] EDAC/versalnet: fix remoteproc reference leak Guangshuo Li
2026-09-23 11:40 ` Pandey, Radhey Shyam
2026-09-27 21:17   ` Borislav Petkov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®