From: Borislav Petkov <bp@alien8.de>
To: kensanya@163.com
Cc: Mauro Carvalho Chehab <mchehab@kernel.org>,
Tony Luck <tony.luck@intel.com>,
linux-edac@vger.kernel.org, linux-kernel@vger.kernel.org,
TanZheng <tanzheng@kylinos.cn>
Subject: Re: [PATCH] EDAC/ghes: reset DMI scan state after registration failure
Date: Thu, 10 Sep 2026 22:06:02 -0700 [thread overview]
Message-ID: <20260911050602.GDaqOMOniLk1fqaW-e@fat_crate.local> (raw)
In-Reply-To: <20260909071934.314577-1-kensanya@163.com>
On Wed, Sep 09, 2026 at 03:19:34PM +0800, kensanya@163.com wrote:
> From: TanZheng <tanzheng@kylinos.cn>
>
> ghes_scan_system() sets system_scanned after the DMI walk. The unlock
> path always kfree()s ghes_hw.dimms but left system_scanned and
> num_dimms set, so a later ghes_edac_register() skipped the scan and
> indexed a NULL dimms array.
>
> Clear the scan flag (and num_dimms) in that shared unlock path when a
> scan actually ran. The next register() will walk DMI again.
>
> Signed-off-by: TanZheng <tanzheng@kylinos.cn>
> ---
> drivers/edac/ghes_edac.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/drivers/edac/ghes_edac.c b/drivers/edac/ghes_edac.c
> index d80c88818691..b0630f1a2815 100644
> --- a/drivers/edac/ghes_edac.c
> +++ b/drivers/edac/ghes_edac.c
> @@ -499,6 +499,10 @@ static int ghes_edac_register(struct device *dev)
> /* Not needed anymore */
> kfree(ghes_hw.dimms);
> ghes_hw.dimms = NULL;
> + if (system_scanned) {
> + system_scanned = false;
> + ghes_hw.num_dimms = 0;
> + }
>
> mutex_unlock(&ghes_reg_mutex);
>
> --
That's not the right fix. On unlock, it returns an error which the caller
should check and then unwind by calling ghes_edac_unregister() on the already
successfully registered instances.
But I don't have the necessary hardware to test it on and if you don't have it
either, don't bother fixing it. Might as well obsolete this driver too.
Thx.
--
Regards/Gruss,
Boris.
https://people.kernel.org/tglx/notes-about-netiquette
prev parent reply other threads:[~2026-09-11 5:06 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-09 7:19 kensanya
2026-09-11 5:06 ` Borislav Petkov [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=20260911050602.GDaqOMOniLk1fqaW-e@fat_crate.local \
--to=bp@alien8.de \
--cc=kensanya@163.com \
--cc=linux-edac@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mchehab@kernel.org \
--cc=tanzheng@kylinos.cn \
--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
all inboxes | Powered by JetHome®