RE: NULL pointer dereference in igen6_probe - 6.16-rc2
From: Zhuo, Qiuxu
Date: Tue Jun 17 2025 - 12:31:51 EST
> From: Borislav Petkov <bp@xxxxxxxxx>
> [...]
> > Reverting 'cfg' in this igen6_edac driver to non-const, allowing it to
> > be set with the actual number of detected memory controllers seems
> reasonable.
>
> Question is: is that something the driver should allow? Detecting more
In the igen6_edac driver, when notified of the memory errors, it checks all
the memory controllers specified by 'cfg->num_imc' to identify the source
of the error.
Either checking if imc->window == NULL (indicating null MMIO for absent
memory controllers) before each usage point, or updating 'cfg->num_imc' to
reflect the real present memory controllers should fix the issue. The latter
one is simpler.
> memory controllers but enabling less. How can that even happen?
>
The maximum number of detected memory controllers is bounded
by the macro NUM_IMC [1]. This value is what we know as the maximum
possible value now.
[1] https://github.com/torvalds/linux/blob/master/drivers/edac/igen6_edac.c#L1324
> > After that then applying Boris' fix above is the simplest way to
> > resolve the issue. 😊
>
> Right, just prepare a proper patch, please, so that Marek can test and confirm.
>
OK.
I'll make a patch for Marek to test first.
Thanks Boris.
- Qiuxu