perf: Fix some hotplug callbask leaks
v2 cover perf: Fix some hotplug callbask leaks
There are some potential leaked hotplug callbacks that were found, and will be fixed by this patch.
Shang XiaoJing (2):
perf/arm_dmc620: Fix hotplug callback leak in dmc620_pmu_init() perf/smmuv3: Fix hotplug callback leak in arm_smmu_pmu_init()
---
changes in v2:
- use one instead of two separate returns.
--- drivers/perf/arm_dmc620_pmu.c | 9 ++++++++- drivers/perf/arm_smmuv3_pmu.c | 9 ++++++++- 2 files changed, 16 insertions(+), 2 deletions(-)
Signature · 7 lines
2.17.1 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
PATCH v2 1/2 perf/arm_dmc620: Fix hotplug callback leak in dmc620_pmu_init()
dmc620_pmu_init() won't remove the callback added by cpuhp_setup_state_multi() when platform_driver_register() failed. Remove the callback by cpuhp_remove_multi_state() in fail path.
Similar to the handling of arm_ccn_init() in commit 26242b330093 ("bus:
arm-ccn: Prevent hotplug callback leak")
---
changes in v2:
- use one instead of two separate returns.
--- drivers/perf/arm_dmc620_pmu.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/perf/arm_dmc620_pmu.c +7 -1
@@ -725,6 +725,8 @@ static struct platform_driver dmc620_pmu_driver = {static int __init dmc620_pmu_init (void ) { +int ret; + cpuhp_state_num = cpuhp_setup_state_multi(CPUHP_AP_ONLINE_DYN, DMC620_DRVNAME, NULL,
@@ -732,7 +734,11 @@ static int __init dmc620_pmu_init(void)if (cpuhp_state_num <0 )return cpuhp_state_num; -return platform_driver_register (&dmc620_pmu_driver); + ret =platform_driver_register (&dmc620_pmu_driver); +if (ret) +cpuhp_remove_multi_state (cpuhp_state_num); + +return ret; } static void __exit dmc620_pmu_exit(void)
Signature · 7 lines
2.17.1 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
PATCH v2 2/2 perf/smmuv3: Fix hotplug callback leak in arm_smmu_pmu_init()
In reply to Shang XiaoJingarm_smmu_pmu_init() won't remove the callback added by cpuhp_setup_state_multi() when platform_driver_register() failed. Remove the callback by cpuhp_remove_multi_state() in fail path.
Similar to the handling of arm_ccn_init() in commit 26242b330093 ("bus:
arm-ccn: Prevent hotplug callback leak")
---
changes in v2:
- use one instead of two separate returns.
--- drivers/perf/arm_smmuv3_pmu.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/perf/arm_smmuv3_pmu.c +7 -1
@@ -959,6 +959,8 @@ static struct platform_driver smmu_pmu_driver = {static int __init arm_smmu_pmu_init (void ) { +int ret; + cpuhp_state_num = cpuhp_setup_state_multi(CPUHP_AP_ONLINE_DYN, "perf/arm/pmcg:online", NULL,
@@ -966,7 +968,11 @@ static int __init arm_smmu_pmu_init(void)if (cpuhp_state_num <0 )return cpuhp_state_num; -return platform_driver_register (&smmu_pmu_driver); + ret =platform_driver_register (&smmu_pmu_driver); +if (ret) +cpuhp_remove_multi_state (cpuhp_state_num); + +return ret; }module_init (arm_smmu_pmu_init);
Signature · 7 lines
2.17.1 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Quoted 8 lines · Shang XiaoJing
There are some potential leaked hotplug callbacks that were found, and will be fixed by this patch.
Shang XiaoJing (2):
perf/arm_dmc620: Fix hotplug callback leak indmc620_pmu_init()perf/smmuv3: Fix hotplug callback leak inarm_smmu_pmu_init()[...]
Applied to will (for-next/perf), thanks!
[1/2] perf/arm_dmc620: Fix hotplug callback leak in dmc620_pmu_init()
https://git.kernel.org/will/c/d9f564c966e6 [2/2] perf/smmuv3: Fix hotplug callback leak in arm_smmu_pmu_init() https://git.kernel.org/will/c/6f2d566b4643
Cheers,
Signature · 10 lines
Will https://fixes.arm64.dev https://next.arm64.dev https://will.arm64.dev _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel