aboutsummaryrefslogtreecommitdiff
path: root/lib/mpi/mpi-sub-ui.c
diff options
context:
space:
mode:
authorAmmar Faizi <[email protected]>2022-03-29 17:47:05 +0700
committerBorislav Petkov <[email protected]>2022-04-05 21:24:37 +0200
commite5f28623ceb103e13fc3d7bd45edf9818b227fd0 (patch)
tree9fd7e8fcb30f7f78c0480713ead8aa1af27f1280 /lib/mpi/mpi-sub-ui.c
parent9f1b19b977ee3cbd3fe9135ff63dbf221eac1d6a (diff)
x86/MCE/AMD: Fix memory leak when threshold_create_bank() fails
In mce_threshold_create_device(), if threshold_create_bank() fails, the previously allocated threshold banks array @bp will be leaked because the call to mce_threshold_remove_device() will not free it. This happens because mce_threshold_remove_device() fetches the pointer through the threshold_banks per-CPU variable but bp is written there only after the bank creation is successful, and not before, when threshold_create_bank() fails. Add a helper which unwinds all the bank creation work previously done and pass into it the previously allocated threshold banks array for freeing. [ bp: Massage. ] Fixes: 6458de97fc15 ("x86/mce/amd: Straighten CPU hotplug path") Co-developed-by: Alviro Iskandar Setiawan <[email protected]> Signed-off-by: Alviro Iskandar Setiawan <[email protected]> Co-developed-by: Yazen Ghannam <[email protected]> Signed-off-by: Yazen Ghannam <[email protected]> Signed-off-by: Ammar Faizi <[email protected]> Signed-off-by: Borislav Petkov <[email protected]> Cc: <[email protected]> Link: https://lore.kernel.org/r/[email protected]
Diffstat (limited to 'lib/mpi/mpi-sub-ui.c')
0 files changed, 0 insertions, 0 deletions