* [PATCH] perf/arm_cspmu: fix device leaks on module unload
@ 2025-11-21 11:52 Johan Hovold
2025-11-24 16:03 ` Will Deacon
0 siblings, 1 reply; 3+ messages in thread
From: Johan Hovold @ 2025-11-21 11:52 UTC (permalink / raw)
To: Will Deacon, Mark Rutland
Cc: linux-arm-kernel, linux-perf-users, linux-kernel, Johan Hovold,
stable, Besar Wicaksono
Make sure to drop the references taken when looking up the backend
devices during vendor module unload.
Fixes: bfc653aa89cb ("perf: arm_cspmu: Separate Arm and vendor module")
Cc: stable@vger.kernel.org # 6.7
Cc: Besar Wicaksono <bwicaksono@nvidia.com>
Signed-off-by: Johan Hovold <johan@kernel.org>
---
drivers/perf/arm_cspmu/arm_cspmu.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/perf/arm_cspmu/arm_cspmu.c b/drivers/perf/arm_cspmu/arm_cspmu.c
index efa9b229e701..e0d4293f06f9 100644
--- a/drivers/perf/arm_cspmu/arm_cspmu.c
+++ b/drivers/perf/arm_cspmu/arm_cspmu.c
@@ -1365,8 +1365,10 @@ void arm_cspmu_impl_unregister(const struct arm_cspmu_impl_match *impl_match)
/* Unbind the driver from all matching backend devices. */
while ((dev = driver_find_device(&arm_cspmu_driver.driver, NULL,
- match, arm_cspmu_match_device)))
+ match, arm_cspmu_match_device))) {
device_release_driver(dev);
+ put_device(dev);
+ }
mutex_lock(&arm_cspmu_lock);
--
2.51.2
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH] perf/arm_cspmu: fix device leaks on module unload
2025-11-21 11:52 [PATCH] perf/arm_cspmu: fix device leaks on module unload Johan Hovold
@ 2025-11-24 16:03 ` Will Deacon
2025-11-24 16:11 ` Johan Hovold
0 siblings, 1 reply; 3+ messages in thread
From: Will Deacon @ 2025-11-24 16:03 UTC (permalink / raw)
To: Johan Hovold
Cc: Mark Rutland, linux-arm-kernel, linux-perf-users, linux-kernel,
stable, Besar Wicaksono
On Fri, Nov 21, 2025 at 12:52:13PM +0100, Johan Hovold wrote:
> Make sure to drop the references taken when looking up the backend
> devices during vendor module unload.
>
> Fixes: bfc653aa89cb ("perf: arm_cspmu: Separate Arm and vendor module")
> Cc: stable@vger.kernel.org # 6.7
> Cc: Besar Wicaksono <bwicaksono@nvidia.com>
> Signed-off-by: Johan Hovold <johan@kernel.org>
> ---
> drivers/perf/arm_cspmu/arm_cspmu.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/perf/arm_cspmu/arm_cspmu.c b/drivers/perf/arm_cspmu/arm_cspmu.c
> index efa9b229e701..e0d4293f06f9 100644
> --- a/drivers/perf/arm_cspmu/arm_cspmu.c
> +++ b/drivers/perf/arm_cspmu/arm_cspmu.c
> @@ -1365,8 +1365,10 @@ void arm_cspmu_impl_unregister(const struct arm_cspmu_impl_match *impl_match)
>
> /* Unbind the driver from all matching backend devices. */
> while ((dev = driver_find_device(&arm_cspmu_driver.driver, NULL,
> - match, arm_cspmu_match_device)))
> + match, arm_cspmu_match_device))) {
> device_release_driver(dev);
> + put_device(dev);
> + }
There's already a fix queued for this; please take a look:
https://git.kernel.org/pub/scm/linux/kernel/git/will/linux.git/commit/?h=for-next/perf&id=970e1e41805f0bd49dc234330a9390f4708d097d
Wil
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] perf/arm_cspmu: fix device leaks on module unload
2025-11-24 16:03 ` Will Deacon
@ 2025-11-24 16:11 ` Johan Hovold
0 siblings, 0 replies; 3+ messages in thread
From: Johan Hovold @ 2025-11-24 16:11 UTC (permalink / raw)
To: Will Deacon
Cc: Mark Rutland, linux-arm-kernel, linux-perf-users, linux-kernel,
stable, Besar Wicaksono
On Mon, Nov 24, 2025 at 04:03:29PM +0000, Will Deacon wrote:
> On Fri, Nov 21, 2025 at 12:52:13PM +0100, Johan Hovold wrote:
> > Make sure to drop the references taken when looking up the backend
> > devices during vendor module unload.
> >
> > Fixes: bfc653aa89cb ("perf: arm_cspmu: Separate Arm and vendor module")
> > Cc: stable@vger.kernel.org # 6.7
> > Cc: Besar Wicaksono <bwicaksono@nvidia.com>
> > Signed-off-by: Johan Hovold <johan@kernel.org>
> > ---
> > drivers/perf/arm_cspmu/arm_cspmu.c | 4 +++-
> > 1 file changed, 3 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/perf/arm_cspmu/arm_cspmu.c b/drivers/perf/arm_cspmu/arm_cspmu.c
> > index efa9b229e701..e0d4293f06f9 100644
> > --- a/drivers/perf/arm_cspmu/arm_cspmu.c
> > +++ b/drivers/perf/arm_cspmu/arm_cspmu.c
> > @@ -1365,8 +1365,10 @@ void arm_cspmu_impl_unregister(const struct arm_cspmu_impl_match *impl_match)
> >
> > /* Unbind the driver from all matching backend devices. */
> > while ((dev = driver_find_device(&arm_cspmu_driver.driver, NULL,
> > - match, arm_cspmu_match_device)))
> > + match, arm_cspmu_match_device))) {
> > device_release_driver(dev);
> > + put_device(dev);
> > + }
>
> There's already a fix queued for this; please take a look:
>
> https://git.kernel.org/pub/scm/linux/kernel/git/will/linux.git/commit/?h=for-next/perf&id=970e1e41805f0bd49dc234330a9390f4708d097d
Ah, forgot to check linux-next here, sorry.
The diff of that commit is identical even if the commit summary is a bit
misleading as this is not an error path.
Johan
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-11-24 16:11 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-11-21 11:52 [PATCH] perf/arm_cspmu: fix device leaks on module unload Johan Hovold
2025-11-24 16:03 ` Will Deacon
2025-11-24 16:11 ` Johan Hovold
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).