mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: kensanya@163.com
To: Mauro Carvalho Chehab <mchehab@kernel.org>,
	Borislav Petkov <bp@alien8.de>, Tony Luck <tony.luck@intel.com>
Cc: linux-edac@vger.kernel.org, linux-kernel@vger.kernel.org,
	TanZheng <tanzheng@kylinos.cn>
Subject: [PATCH] EDAC/ghes: reset DMI scan state after registration failure
Date: Wed,  9 Sep 2026 15:19:34 +0800	[thread overview]
Message-ID: <20260909071934.314577-1-kensanya@163.com> (raw)

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);
 
-- 
2.25.1


             reply	other threads:[~2026-09-09  7:20 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-09  7:19 kensanya [this message]
2026-09-11  5:06 ` 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=20260909071934.314577-1-kensanya@163.com \
    --to=kensanya@163.com \
    --cc=bp@alien8.de \
    --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®