linux/drivers/perf/hisilicon
Junhao He b805cafc60 perf: hisi: Fix use-after-free when register pmu fails
When we fail to register the uncore pmu, the pmu context may not been
allocated. The error handing will call cpuhp_state_remove_instance()
to call uncore pmu offline callback, which migrate the pmu context.
Since that's liable to lead to some kind of use-after-free.

Use cpuhp_state_remove_instance_nocalls() instead of
cpuhp_state_remove_instance() so that the notifiers don't execute after
the PMU device has been failed to register.

Fixes: a0ab25cd82 ("drivers/perf: hisi: Add support for HiSilicon PA PMU driver")
FIxes: 3bf30882c3 ("drivers/perf: hisi: Add support for HiSilicon SLLC PMU driver")
Signed-off-by: Junhao He <hejunhao3@huawei.com>
Link: https://lore.kernel.org/r/20231024113630.13472-1-hejunhao3@huawei.com
Signed-off-by: Will Deacon <will@kernel.org>
2023-10-24 13:30:02 +01:00
..
hisi_pcie_pmu.c drivers/perf: hisi_pcie: Initialize event->cpu only on success 2023-10-24 12:30:45 +01:00
hisi_uncore_cpa_pmu.c drivers/perf: hisi: Remove redundant initialized of pmu->name 2023-04-17 13:14:10 +01:00
hisi_uncore_ddrc_pmu.c drivers/perf: hisi: add NULL check for name 2023-04-17 13:14:10 +01:00
hisi_uncore_hha_pmu.c drivers/perf: hisi: add NULL check for name 2023-04-17 13:14:10 +01:00
hisi_uncore_l3c_pmu.c drivers/perf: hisi: add NULL check for name 2023-04-17 13:14:10 +01:00
hisi_uncore_pa_pmu.c perf: hisi: Fix use-after-free when register pmu fails 2023-10-24 13:30:02 +01:00
hisi_uncore_pmu.c drivers/perf: hisi: Add support for HiSilicon UC PMU driver 2023-06-16 12:27:38 +01:00
hisi_uncore_pmu.h drivers/perf: hisi: Add support for HiSilicon UC PMU driver 2023-06-16 12:27:38 +01:00
hisi_uncore_sllc_pmu.c perf: hisi: Fix use-after-free when register pmu fails 2023-10-24 13:30:02 +01:00
hisi_uncore_uc_pmu.c drivers/perf: hisi: Add support for HiSilicon UC PMU driver 2023-06-16 12:27:38 +01:00
hns3_pmu.c drivers/perf: hisi: use cpuhp_state_remove_instance_nocalls() for hisi_hns3_pmu uninit process 2023-10-19 15:30:49 +01:00
Kconfig drivers/perf: hisi: add driver for HNS3 PMU 2022-07-06 11:25:53 +01:00
Makefile drivers/perf: hisi: Add support for HiSilicon UC PMU driver 2023-06-16 12:27:38 +01:00