Re: NULL pointer dereference in igen6_probe - 6.16-rc2

From: Borislav Petkov
Date: Tue Jun 17 2025 - 07:57:36 EST


On Tue, Jun 17, 2025 at 01:13:49PM +0200, Marek Marczykowski-Górecki wrote:
> [ 13.562085] intel_pmc_core INT33A1:00: Assuming a default substate order for this platform
> [ 13.562682] intel_pmc_core INT33A1:00: initialized
> [ 13.565035] EDAC MC0: Giving out device to module igen6_edac controller Intel_client_SoC MC#0: DEV 0000:00:00.0 (INTERRUPT)
> [ 13.565746] EDAC igen6: Expected 2 mcs, but only 1 detected.

Well, folks, if you've detected only one memory controller, then work with
only one and do not kill the machine:

diff --git a/drivers/edac/igen6_edac.c b/drivers/edac/igen6_edac.c
index 1930dc00c791..23e26ba2d49b 100644
--- a/drivers/edac/igen6_edac.c
+++ b/drivers/edac/igen6_edac.c
@@ -1350,9 +1350,11 @@ static int igen6_register_mcis(struct pci_dev *pdev, u64 mchbar)
return -ENODEV;
}

- if (lmc < res_cfg->num_imc)
+ if (lmc < res_cfg->num_imc) {
igen6_printk(KERN_WARNING, "Expected %d mcs, but only %d detected.",
res_cfg->num_imc, lmc);
+ res_cfg->num_imc = lmc;
+ }

return 0;

---

but then that cfg struct is const :-\

drivers/edac/igen6_edac.c: In function ‘igen6_register_mcis’:
drivers/edac/igen6_edac.c:1356:34: error: assignment of member ‘num_imc’ in read-only object
1356 | res_cfg->num_imc = lmc;
| ^


Unless it is some gunky crap this coreboot does - then we will have to have
a longer talk.

:-P

Thx.


--
Regards/Gruss,
Boris.

https://people.kernel.org/tglx/notes-about-netiquette