From: Sughosh Ganu Date: Thu, 26 Apr 2018 10:16:49 +0000 (+0530) Subject: EDAC, ghes: Add a null pointer check in ghes_edac_unregister() X-Git-Tag: v4.19~880^2~12 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a66bdf5d11b0ba8e473ef90ba7e0e6399b5fc825;p=platform%2Fkernel%2Flinux-rpi.git EDAC, ghes: Add a null pointer check in ghes_edac_unregister() 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. Reviewed-by: Toshi Kani Signed-off-by: Sughosh Ganu Cc: Mauro Carvalho Chehab Cc: linux-edac Cc: lkml Link: http://lkml.kernel.org/r/1524737809-24475-1-git-send-email-sughosh.ganu@arm.com Signed-off-by: Borislav Petkov --- diff --git a/drivers/edac/ghes_edac.c b/drivers/edac/ghes_edac.c index 7fdbfe8..7587440 100644 --- a/drivers/edac/ghes_edac.c +++ b/drivers/edac/ghes_edac.c @@ -517,6 +517,9 @@ void ghes_edac_unregister(struct ghes *ghes) { struct mem_ctl_info *mci; + if (!ghes_pvt) + return; + mci = ghes_pvt->mci; edac_mc_del_mc(mci->pdev); edac_mc_free(mci);