summaryrefslogtreecommitdiffstats
path: root/drivers/edac
diff options
context:
space:
mode:
authorSughosh Ganu <sughosh.ganu@arm.com>2018-04-26 06:16:49 -0400
committerBorislav Petkov <bp@suse.de>2018-05-02 07:57:49 -0400
commita66bdf5d11b0ba8e473ef90ba7e0e6399b5fc825 (patch)
tree751641cbbf78318277da3da5cc19366dfdecd2b7 /drivers/edac
parentcc7f3f132658289b6661ab8294ab08a9d32ea026 (diff)
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 <toshi.kani@hpe.com> Signed-off-by: Sughosh Ganu <sughosh.ganu@arm.com> Cc: Mauro Carvalho Chehab <mchehab@kernel.org> Cc: linux-edac <linux-edac@vger.kernel.org> Cc: lkml <linux-kernel@vger.kernel.org> Link: http://lkml.kernel.org/r/1524737809-24475-1-git-send-email-sughosh.ganu@arm.com Signed-off-by: Borislav Petkov <bp@suse.de>
Diffstat (limited to 'drivers/edac')
-rw-r--r--drivers/edac/ghes_edac.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/edac/ghes_edac.c b/drivers/edac/ghes_edac.c
index 7fdbfe871f5c..758744038d93 100644
--- a/drivers/edac/ghes_edac.c
+++ b/drivers/edac/ghes_edac.c
@@ -517,6 +517,9 @@ void ghes_edac_unregister(struct ghes *ghes)
517{ 517{
518 struct mem_ctl_info *mci; 518 struct mem_ctl_info *mci;
519 519
520 if (!ghes_pvt)
521 return;
522
520 mci = ghes_pvt->mci; 523 mci = ghes_pvt->mci;
521 edac_mc_del_mc(mci->pdev); 524 edac_mc_del_mc(mci->pdev);
522 edac_mc_free(mci); 525 edac_mc_free(mci);