mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] EDAC/ghes: reset DMI scan state after registration failure
@ 2026-09-09  7:19 kensanya
  2026-09-11  5:06 ` Borislav Petkov
  0 siblings, 1 reply; 2+ messages in thread
From: kensanya @ 2026-09-09  7:19 UTC (permalink / raw)
  To: Mauro Carvalho Chehab, Borislav Petkov, Tony Luck
  Cc: linux-edac, linux-kernel, TanZheng

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


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

end of thread, other threads:[~2026-09-11  5:06 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-09  7:19 [PATCH] EDAC/ghes: reset DMI scan state after registration failure kensanya
2026-09-11  5:06 ` 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®