Re: [PATCH 1/1] EDAC/ghes: Fix for NULL pointer dereference in ghes_edac_register()

From: Borislav Petkov
Date: Tue Sep 15 2020 - 08:29:11 EST


On Tue, Sep 15, 2020 at 10:54:33AM +0000, Shiju Jose wrote:
> I debug with adding more logs. I found that in our platform
> hw->num_dimms was 32 when called ghes_edac_register() second time when
> probe a new ghes instance, the check !(hw->num_dimms % 16) in the
> enumerate_dimms() passed and it allocated memory for hw->dimms. Thus
> it did not fail with NULL pointer dereference in ghes_edac_register().

Oh, what a lucky coincidence ;-\

> With the your new fix hw->num_dimms reset to 0.

Thanks for testing and digging out what is happening on your machine. So
I've queued them here:

https://git.kernel.org/pub/scm/linux/kernel/git/ras/ras.git/log/?h=edac-for-next

Will send them to Linus on the weekend so that they make it into 5.9.

Thx.

--
Regards/Gruss,
Boris.

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