summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2019-10-23 06:19:07 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2019-10-23 06:19:07 -0400
commite969c860d56345b2c2efd2bf2b6d8c716bdc1468 (patch)
treecbb7328e25a1342ef1b4fe68a1a281a0563680fb /drivers
parent54955e3bfde54dcdd29694741f2ddfc6b763b193 (diff)
parent1e72e673b9d102ff2e8333e74b3308d012ddf75b (diff)
downloadlinux-e969c860d56345b2c2efd2bf2b6d8c716bdc1468.tar.bz2
Merge tag 'edac_urgent_for_5.4' of git://git.kernel.org/pub/scm/linux/kernel/git/ras/ras
Pull EDAC fix from Borislav Petkov: "Fix ghes_edac UAF case triggered by KASAN and DEBUG_TEST_DRIVER_REMOVE. Future pending rework of the ghes_edac instances registration will do away with the single memory controller per system model and that ugly hackery there. This is a minimal fix for stable@, courtesy of James Morse" * tag 'edac_urgent_for_5.4' of git://git.kernel.org/pub/scm/linux/kernel/git/ras/ras: EDAC/ghes: Fix Use after free in ghes_edac remove path
Diffstat (limited to 'drivers')
-rw-r--r--drivers/edac/ghes_edac.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/edac/ghes_edac.c b/drivers/edac/ghes_edac.c
index d413a0bdc9ad..0bb62857ffb2 100644
--- a/drivers/edac/ghes_edac.c
+++ b/drivers/edac/ghes_edac.c
@@ -553,7 +553,11 @@ void ghes_edac_unregister(struct ghes *ghes)
if (!ghes_pvt)
return;
+ if (atomic_dec_return(&ghes_init))
+ return;
+
mci = ghes_pvt->mci;
+ ghes_pvt = NULL;
edac_mc_del_mc(mci->pdev);
edac_mc_free(mci);
}