[PATCH] perf: hisi: Fix use-after-free when register pmu fails

Will Deacon will at kernel.org
Tue Oct 24 05:51:11 PDT 2023


On Tue, 24 Oct 2023 19:36:30 +0800, Junhao He wrote:
> 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.
> 
> [...]

Applied to will (for-next/perf), thanks!

[1/1] perf: hisi: Fix use-after-free when register pmu fails
      https://git.kernel.org/will/c/b805cafc604b

Cheers,
-- 
Will

https://fixes.arm64.dev
https://next.arm64.dev
https://will.arm64.dev



More information about the linux-arm-kernel mailing list