linux-stable/drivers/perf/hisilicon
Junhao He b660420f44 perf: hisi: Fix use-after-free when register pmu fails
[ Upstream commit b805cafc60 ]

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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2023-11-20 11:52:01 +01:00
..
Kconfig drivers/perf: hisi: add driver for HNS3 PMU 2022-07-06 11:25:53 +01:00
Makefile drivers/perf: hisi: add driver for HNS3 PMU 2022-07-06 11:25:53 +01:00
hisi_pcie_pmu.c drivers/perf: hisi_pcie: Check the type first in pmu::event_init() 2023-11-20 11:52:01 +01:00
hisi_uncore_cpa_pmu.c
hisi_uncore_ddrc_pmu.c
hisi_uncore_hha_pmu.c
hisi_uncore_l3c_pmu.c
hisi_uncore_pa_pmu.c perf: hisi: Fix use-after-free when register pmu fails 2023-11-20 11:52:01 +01:00
hisi_uncore_pmu.c
hisi_uncore_pmu.h
hisi_uncore_sllc_pmu.c perf: hisi: Fix use-after-free when register pmu fails 2023-11-20 11:52:01 +01:00
hns3_pmu.c drivers/perf: hisi: use cpuhp_state_remove_instance_nocalls() for hisi_hns3_pmu uninit process 2023-11-20 11:52:01 +01:00