Commit e969c860 authored by Linus Torvalds's avatar Linus Torvalds
Browse files

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
parents 54955e3b 1e72e673
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -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);
}