Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Michal Simek <michal.simek@amd.com>
To: Yuho Choi <dbgh9129@gmail.com>, Borislav Petkov <bp@alien8.de>,
	Tony Luck <tony.luck@intel.com>
Cc: linux-edac@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] EDAC/synopsys: Fix cleanup on injection sysfs failure
Date: Fri, 5 Jun 2026 15:23:35 +0200	[thread overview]
Message-ID: <0f117472-4af3-4aeb-8c8a-c64f9da088e1@amd.com> (raw)
In-Reply-To: <20260605125417.2348115-1-dbgh9129@gmail.com>



On 6/5/26 14:54, Yuho Choi wrote:
> edac_create_sysfs_attributes() creates inject_data_error before
> inject_data_poison. If the second file creation fails, the first file is
> left behind.
> 
> The same failure path runs after edac_mc_add_mc() has registered the
> memory controller with the EDAC core. Jumping directly to edac_mc_free()
> skips edac_mc_del_mc() and leaves the registered controller state
> unwound incorrectly.
> 
> Remove inject_data_error when inject_data_poison creation fails, and
> route the probe failure through edac_mc_del_mc() before freeing mci.
> 
> Fixes: 1a81361f75d8 ("EDAC, synopsys: Add Error Injection support for ZynqMP DDR controller")
> Signed-off-by: Yuho Choi <dbgh9129@gmail.com>
> ---
> Changes in v2:
> - Remove the CONFIG_EDAC_DEBUG-guarded del_mc label.
> - Call edac_mc_del_mc() inline before jumping to free_edac_mc when
>    edac_create_sysfs_attributes() fails.
> 
>   drivers/edac/synopsys_edac.c | 5 ++++-
>   1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/edac/synopsys_edac.c b/drivers/edac/synopsys_edac.c
> index 51143b3257de..9ca2a842612e 100644
> --- a/drivers/edac/synopsys_edac.c
> +++ b/drivers/edac/synopsys_edac.c
> @@ -1120,8 +1120,10 @@ static int edac_create_sysfs_attributes(struct mem_ctl_info *mci)
>   	if (rc < 0)
>   		return rc;
>   	rc = device_create_file(&mci->dev, &dev_attr_inject_data_poison);
> -	if (rc < 0)
> +	if (rc < 0) {
> +		device_remove_file(&mci->dev, &dev_attr_inject_data_error);
>   		return rc;
> +	}
>   	return 0;
>   }
>   
> @@ -1431,6 +1433,7 @@ static int mc_probe(struct platform_device *pdev)
>   		if (rc) {
>   			edac_printk(KERN_ERR, EDAC_MC,
>   					"Failed to create sysfs entries\n");
> +			edac_mc_del_mc(&pdev->dev);
>   			goto free_edac_mc;
>   		}
>   	}

Cc: stable@vger.kernel.org
Acked-by: Michal Simek <michal.simek@amd.com>

Thanks,
Michal




  reply	other threads:[~2026-06-05 13:24 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-05 12:54 [PATCH v2] EDAC/synopsys: Fix cleanup on injection sysfs failure Yuho Choi
2026-06-05 13:23 ` Michal Simek [this message]
2026-06-10 17:27 ` Borislav Petkov

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=0f117472-4af3-4aeb-8c8a-c64f9da088e1@amd.com \
    --to=michal.simek@amd.com \
    --cc=bp@alien8.de \
    --cc=dbgh9129@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-edac@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --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