All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] perf: Fix some hotplug callback leaks
@ 2022-11-15  7:02 Yuan Can
  2022-11-15  7:02 ` [PATCH 1/2] perf: arm_dsu: Fix hotplug callback leak in dsu_pmu_init() Yuan Can
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Yuan Can @ 2022-11-15  7:02 UTC (permalink / raw)
  To: will, mark.rutland, bbudiredla, suzuki.poulose, Jonathan.Cameron,
	linux-arm-kernel
  Cc: yuancan

This series fix two error handling missing related problems that can lead
to hotplug callback leaks.

Yuan Can (2):
  perf: arm_dsu: Fix hotplug callback leak in dsu_pmu_init()
  drivers: perf: marvell_cn10k: Fix hotplug callback leak in
    tad_pmu_init()

 drivers/perf/arm_dsu_pmu.c           | 6 +++++-
 drivers/perf/marvell_cn10k_tad_pmu.c | 6 +++++-
 2 files changed, 10 insertions(+), 2 deletions(-)

-- 
2.17.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 1/2] perf: arm_dsu: Fix hotplug callback leak in dsu_pmu_init()
  2022-11-15  7:02 [PATCH 0/2] perf: Fix some hotplug callback leaks Yuan Can
@ 2022-11-15  7:02 ` Yuan Can
  2022-11-15 11:44   ` Suzuki K Poulose
  2022-11-15  7:02 ` [PATCH 2/2] drivers: perf: marvell_cn10k: Fix hotplug callback leak in tad_pmu_init() Yuan Can
  2022-11-15 18:32 ` [PATCH 0/2] perf: Fix some hotplug callback leaks Will Deacon
  2 siblings, 1 reply; 5+ messages in thread
From: Yuan Can @ 2022-11-15  7:02 UTC (permalink / raw)
  To: will, mark.rutland, bbudiredla, suzuki.poulose, Jonathan.Cameron,
	linux-arm-kernel
  Cc: yuancan

dsu_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")

Fixes: 7520fa99246d ("perf: ARM DynamIQ Shared Unit PMU support")
Signed-off-by: Yuan Can <yuancan@huawei.com>
---
 drivers/perf/arm_dsu_pmu.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/perf/arm_dsu_pmu.c b/drivers/perf/arm_dsu_pmu.c
index 4a15c86f45ef..fe2abb412c00 100644
--- a/drivers/perf/arm_dsu_pmu.c
+++ b/drivers/perf/arm_dsu_pmu.c
@@ -858,7 +858,11 @@ static int __init dsu_pmu_init(void)
 	if (ret < 0)
 		return ret;
 	dsu_pmu_cpuhp_state = ret;
-	return platform_driver_register(&dsu_pmu_driver);
+	ret = platform_driver_register(&dsu_pmu_driver);
+	if (ret)
+		cpuhp_remove_multi_state(dsu_pmu_cpuhp_state);
+
+	return ret;
 }
 
 static void __exit dsu_pmu_exit(void)
-- 
2.17.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 2/2] drivers: perf: marvell_cn10k: Fix hotplug callback leak in tad_pmu_init()
  2022-11-15  7:02 [PATCH 0/2] perf: Fix some hotplug callback leaks Yuan Can
  2022-11-15  7:02 ` [PATCH 1/2] perf: arm_dsu: Fix hotplug callback leak in dsu_pmu_init() Yuan Can
@ 2022-11-15  7:02 ` Yuan Can
  2022-11-15 18:32 ` [PATCH 0/2] perf: Fix some hotplug callback leaks Will Deacon
  2 siblings, 0 replies; 5+ messages in thread
From: Yuan Can @ 2022-11-15  7:02 UTC (permalink / raw)
  To: will, mark.rutland, bbudiredla, suzuki.poulose, Jonathan.Cameron,
	linux-arm-kernel
  Cc: yuancan

tad_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")

Fixes: 036a7584bede ("drivers: perf: Add LLC-TAD perf counter support")
Signed-off-by: Yuan Can <yuancan@huawei.com>
---
 drivers/perf/marvell_cn10k_tad_pmu.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/perf/marvell_cn10k_tad_pmu.c b/drivers/perf/marvell_cn10k_tad_pmu.c
index 69c3050a4348..a1166afb3702 100644
--- a/drivers/perf/marvell_cn10k_tad_pmu.c
+++ b/drivers/perf/marvell_cn10k_tad_pmu.c
@@ -408,7 +408,11 @@ static int __init tad_pmu_init(void)
 	if (ret < 0)
 		return ret;
 	tad_pmu_cpuhp_state = ret;
-	return platform_driver_register(&tad_pmu_driver);
+	ret = platform_driver_register(&tad_pmu_driver);
+	if (ret)
+		cpuhp_remove_multi_state(tad_pmu_cpuhp_state);
+
+	return ret;
 }
 
 static void __exit tad_pmu_exit(void)
-- 
2.17.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/2] perf: arm_dsu: Fix hotplug callback leak in dsu_pmu_init()
  2022-11-15  7:02 ` [PATCH 1/2] perf: arm_dsu: Fix hotplug callback leak in dsu_pmu_init() Yuan Can
@ 2022-11-15 11:44   ` Suzuki K Poulose
  0 siblings, 0 replies; 5+ messages in thread
From: Suzuki K Poulose @ 2022-11-15 11:44 UTC (permalink / raw)
  To: Yuan Can, will, mark.rutland, bbudiredla, Jonathan.Cameron,
	linux-arm-kernel

On 15/11/2022 07:02, Yuan Can wrote:
> dsu_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")
> 
> Fixes: 7520fa99246d ("perf: ARM DynamIQ Shared Unit PMU support")
> Signed-off-by: Yuan Can <yuancan@huawei.com>

Acked-by: Suzuki K Poulose <suzuki.poulose@arm.com>

> ---
>   drivers/perf/arm_dsu_pmu.c | 6 +++++-
>   1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/perf/arm_dsu_pmu.c b/drivers/perf/arm_dsu_pmu.c
> index 4a15c86f45ef..fe2abb412c00 100644
> --- a/drivers/perf/arm_dsu_pmu.c
> +++ b/drivers/perf/arm_dsu_pmu.c
> @@ -858,7 +858,11 @@ static int __init dsu_pmu_init(void)
>   	if (ret < 0)
>   		return ret;
>   	dsu_pmu_cpuhp_state = ret;
> -	return platform_driver_register(&dsu_pmu_driver);
> +	ret = platform_driver_register(&dsu_pmu_driver);
> +	if (ret)
> +		cpuhp_remove_multi_state(dsu_pmu_cpuhp_state);
> +
> +	return ret;
>   }
>   
>   static void __exit dsu_pmu_exit(void)


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 0/2] perf: Fix some hotplug callback leaks
  2022-11-15  7:02 [PATCH 0/2] perf: Fix some hotplug callback leaks Yuan Can
  2022-11-15  7:02 ` [PATCH 1/2] perf: arm_dsu: Fix hotplug callback leak in dsu_pmu_init() Yuan Can
  2022-11-15  7:02 ` [PATCH 2/2] drivers: perf: marvell_cn10k: Fix hotplug callback leak in tad_pmu_init() Yuan Can
@ 2022-11-15 18:32 ` Will Deacon
  2 siblings, 0 replies; 5+ messages in thread
From: Will Deacon @ 2022-11-15 18:32 UTC (permalink / raw)
  To: bbudiredla, suzuki.poulose, Yuan Can, mark.rutland,
	linux-arm-kernel, Jonathan.Cameron
  Cc: catalin.marinas, kernel-team, Will Deacon

On Tue, 15 Nov 2022 07:02:05 +0000, Yuan Can wrote:
> This series fix two error handling missing related problems that can lead
> to hotplug callback leaks.
> 
> Yuan Can (2):
>   perf: arm_dsu: Fix hotplug callback leak in dsu_pmu_init()
>   drivers: perf: marvell_cn10k: Fix hotplug callback leak in
>     tad_pmu_init()
> 
> [...]

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

[1/2] perf: arm_dsu: Fix hotplug callback leak in dsu_pmu_init()
      https://git.kernel.org/will/c/facafab7611f
[2/2] drivers: perf: marvell_cn10k: Fix hotplug callback leak in tad_pmu_init()
      https://git.kernel.org/will/c/973ae93d80d9

Cheers,
-- 
Will

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

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2022-11-15 18:36 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-15  7:02 [PATCH 0/2] perf: Fix some hotplug callback leaks Yuan Can
2022-11-15  7:02 ` [PATCH 1/2] perf: arm_dsu: Fix hotplug callback leak in dsu_pmu_init() Yuan Can
2022-11-15 11:44   ` Suzuki K Poulose
2022-11-15  7:02 ` [PATCH 2/2] drivers: perf: marvell_cn10k: Fix hotplug callback leak in tad_pmu_init() Yuan Can
2022-11-15 18:32 ` [PATCH 0/2] perf: Fix some hotplug callback leaks Will Deacon

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.