Skip to content
Commit b805cafc authored by Junhao He's avatar Junhao He Committed by Will Deacon
Browse files

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: a0ab25cd ("drivers/perf: hisi: Add support for HiSilicon PA PMU driver")
FIxes: 3bf30882 ("drivers/perf: hisi: Add support for HiSilicon SLLC PMU driver")
Signed-off-by: default avatarJunhao He <hejunhao3@huawei.com>
Link: https://lore.kernel.org/r/20231024113630.13472-1-hejunhao3@huawei.com


Signed-off-by: default avatarWill Deacon <will@kernel.org>
parent 868f8a70
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment