Skip to contentSkip to conversation

ghes_edac: Add a null pointer check in ghes_edac_unregister

DISCUSSION Borislav Petkov 1 participant 1 message Apr 30, 2018 EDAC-core

lore
Share & tools
lore

Borislav Petkov

author maintainer Applied
#0 lore raw
Quoted 9 lines · Sughosh Ganu

Add a null check for ghes_pvt, before dereferencing it. The pointer could still be null in case the return path is taken before initialising ghes_pvt in the registration function.

ghes_edac_register function can return a 0 without initialising ghes_pvt -- this is not taken as an error in ghes_probe. A subsequent call to ghes_edac_unregister would result in ghes_pvt getting dereferenced, resulting in a panic.

Quoted 5 lines

---

 drivers/edac/ghes_edac.c | 3 +++
 1 file changed, 3 insertions(+)

Applied, thanks.

So yeah, the registration of ghes_edac thing is kinda causing us headaches so I redid the reg path a bit. Mind running this branch on your setup to make sure it works as expected?

https://git.kernel.org/pub/scm/linux/kernel/git/bp/bp.git/log/?h=edac

Thx.