Linux EDAC development
 help / color / mirror / Atom feed
From: Prasanna Kumar T S M <ptsm@linux.microsoft.com>
To: Shubhrajyoti Datta <shubhrajyoti.datta@gmail.com>
Cc: ssengar@linux.microsoft.com, shubhrajyoti.datta@amd.com,
	bp@alien8.de, tony.luck@intel.com, linux-edac@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 1/3] EDAC/versalnet: Fix teardown ordering in mc_remove()
Date: Thu, 9 Jul 2026 12:02:14 +0530	[thread overview]
Message-ID: <acc5b2b9-6821-4e12-9efe-69c24037490d@linux.microsoft.com> (raw)
In-Reply-To: <CAKfKVtHUqcvv97E2CoETtU2tN5+9SYAgDde=bYQw16hirPM4yw@mail.gmail.com>

Hi Shubrajyoti,

On 08-06-2026 16:41, Shubhrajyoti Datta wrote:
> On Wed, Apr 1, 2026 at 4:56 PM Prasanna Kumar T S M
> <ptsm@linux.microsoft.com> wrote:
>>
>> The teardown sequence in mc_remove() does not mirror the reverse of the
>> initialization order in mc_probe(). In particular,
>> unregister_rpmsg_driver() is called before remove_versalnet(), and
>> cdx_mcdi_finish() is called after rproc_shutdown().
>>
>> Reorder mc_remove() to reverse the probe initialization sequence,
>> consistent with the probe error-unwind paths.
> 
> I think that the remote proc should be quiescence first so that no
> more messages will be
> queued. and then the edac should be removed. See below.
> 
>>
>> The rproc reference acquired via rproc_get_by_phandle() during probe
>> is not released in mc_remove(), causing a reference count leak. Add
>> the missing rproc_put() call.
>>
>> Fixes: d5fe2fec6c40 ("EDAC: Add a driver for the AMD Versal NET DDR controller")
>> Signed-off-by: Prasanna Kumar T S M <ptsm@linux.microsoft.com>
>> ---
>>   drivers/edac/versalnet_edac.c | 5 +++--
>>   1 file changed, 3 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/edac/versalnet_edac.c b/drivers/edac/versalnet_edac.c
>> index b87fe57aa842..acd51b492772 100644
>> --- a/drivers/edac/versalnet_edac.c
>> +++ b/drivers/edac/versalnet_edac.c
>> @@ -955,10 +955,11 @@ static void mc_remove(struct platform_device *pdev)
>>   {
>>          struct mc_priv *priv = platform_get_drvdata(pdev);
>>
>> -       unregister_rpmsg_driver(&amd_rpmsg_driver);
>>          remove_versalnet(priv);
> 
> Here we are removing the edac but the remoteproc  can be triggered.
> calling the remote callback.

Thanks for the review.

This suggests that my change is not complete. I am not sufficiently 
familiar with this area to provide a correct fix, so I will leave it to 
someone more knowledgeable.

> 
>> -       rproc_shutdown(priv->mcdi->r5_rproc);
>>          cdx_mcdi_finish(priv->mcdi);
>> +       unregister_rpmsg_driver(&amd_rpmsg_driver);
>> +       rproc_shutdown(priv->mcdi->r5_rproc);
>> +       rproc_put(priv->mcdi->r5_rproc);
> The put is a valid fix.
> 
>>          kfree(priv->mcdi);
>>   }
>>
>> --
>> 2.49.0
>>
>>

Thanks,
Prasanna

      reply	other threads:[~2026-07-09  6:32 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-01 11:18 [PATCH v2 1/3] EDAC/versalnet: Fix teardown ordering in mc_remove() Prasanna Kumar T S M
2026-04-01 11:18 ` [PATCH v2 2/3] EDAC/versalnet: Fix device name memory leak Prasanna Kumar T S M
2026-05-05 13:19   ` Borislav Petkov
2026-04-01 11:19 ` [PATCH v2 3/3] EDAC/versalnet: Fix device_register() error handling in init_one_mc() Prasanna Kumar T S M
2026-04-09  9:46   ` Prasanna Kumar T S M
2026-04-03 10:34 ` [PATCH v2 1/3] EDAC/versalnet: Fix teardown ordering in mc_remove() Borislav Petkov
2026-04-06  5:26   ` Prasanna Kumar T S M
2026-04-06  8:23     ` Borislav Petkov
2026-04-09  9:33       ` Prasanna Kumar T S M
2026-05-05  9:08         ` Borislav Petkov
2026-06-08 11:11 ` Shubhrajyoti Datta
2026-07-09  6:32   ` Prasanna Kumar T S M [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=acc5b2b9-6821-4e12-9efe-69c24037490d@linux.microsoft.com \
    --to=ptsm@linux.microsoft.com \
    --cc=bp@alien8.de \
    --cc=linux-edac@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=shubhrajyoti.datta@amd.com \
    --cc=shubhrajyoti.datta@gmail.com \
    --cc=ssengar@linux.microsoft.com \
    --cc=tony.luck@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox