stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] amba: tegra-ahb: fix device leak on smmu enable
@ 2025-09-25 15:00 Johan Hovold
  2025-09-26 19:35 ` Markus Elfring
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Johan Hovold @ 2025-09-25 15:00 UTC (permalink / raw)
  To: Russell King, Thierry Reding, Jonathan Hunter
  Cc: linux-tegra, linux-kernel, Johan Hovold, stable

Make sure to drop the reference taken to the ahb platform device when
looking up its driver data while enabling the smmu.

Note that holding a reference to a device does not prevent its driver
data from going away.

Fixes: 89c788bab1f0 ("ARM: tegra: Add SMMU enabler in AHB")
Cc: stable@vger.kernel.org	# 3.5
Signed-off-by: Johan Hovold <johan@kernel.org>
---
 drivers/amba/tegra-ahb.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/amba/tegra-ahb.c b/drivers/amba/tegra-ahb.c
index c0e8b765522d..f23c3ed01810 100644
--- a/drivers/amba/tegra-ahb.c
+++ b/drivers/amba/tegra-ahb.c
@@ -144,6 +144,7 @@ int tegra_ahb_enable_smmu(struct device_node *dn)
 	if (!dev)
 		return -EPROBE_DEFER;
 	ahb = dev_get_drvdata(dev);
+	put_device(dev);
 	val = gizmo_readl(ahb, AHB_ARBITRATION_XBAR_CTRL);
 	val |= AHB_ARBITRATION_XBAR_CTRL_SMMU_INIT_DONE;
 	gizmo_writel(ahb, val, AHB_ARBITRATION_XBAR_CTRL);
-- 
2.49.1


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

* Re: [PATCH] amba: tegra-ahb: fix device leak on smmu enable
  2025-09-25 15:00 [PATCH] amba: tegra-ahb: fix device leak on smmu enable Johan Hovold
@ 2025-09-26 19:35 ` Markus Elfring
  2025-11-05  8:08 ` Johan Hovold
  2025-11-14 16:50 ` Thierry Reding
  2 siblings, 0 replies; 4+ messages in thread
From: Markus Elfring @ 2025-09-26 19:35 UTC (permalink / raw)
  To: Johan Hovold, linux-tegra, Jonathan Hunter, Russell King,
	Thierry Reding
  Cc: stable, LKML

> Make sure to drop the reference taken to the ahb platform device when
> looking up its driver data while enabling the smmu.
…

How do you think about to increase the application of scope-based resource management?
https://elixir.bootlin.com/linux/v6.17-rc7/source/include/linux/device.h#L1180

Regards,
Markus

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

* Re: [PATCH] amba: tegra-ahb: fix device leak on smmu enable
  2025-09-25 15:00 [PATCH] amba: tegra-ahb: fix device leak on smmu enable Johan Hovold
  2025-09-26 19:35 ` Markus Elfring
@ 2025-11-05  8:08 ` Johan Hovold
  2025-11-14 16:50 ` Thierry Reding
  2 siblings, 0 replies; 4+ messages in thread
From: Johan Hovold @ 2025-11-05  8:08 UTC (permalink / raw)
  To: Russell King, Thierry Reding, Jonathan Hunter
  Cc: linux-tegra, linux-kernel, stable

On Thu, Sep 25, 2025 at 05:00:07PM +0200, Johan Hovold wrote:
> Make sure to drop the reference taken to the ahb platform device when
> looking up its driver data while enabling the smmu.
> 
> Note that holding a reference to a device does not prevent its driver
> data from going away.
> 
> Fixes: 89c788bab1f0 ("ARM: tegra: Add SMMU enabler in AHB")
> Cc: stable@vger.kernel.org	# 3.5
> Signed-off-by: Johan Hovold <johan@kernel.org>
> ---

Can this one be picked up for 6.19?

Johan

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

* Re: [PATCH] amba: tegra-ahb: fix device leak on smmu enable
  2025-09-25 15:00 [PATCH] amba: tegra-ahb: fix device leak on smmu enable Johan Hovold
  2025-09-26 19:35 ` Markus Elfring
  2025-11-05  8:08 ` Johan Hovold
@ 2025-11-14 16:50 ` Thierry Reding
  2 siblings, 0 replies; 4+ messages in thread
From: Thierry Reding @ 2025-11-14 16:50 UTC (permalink / raw)
  To: Johan Hovold
  Cc: Russell King, Jonathan Hunter, linux-tegra, linux-kernel, stable

[-- Attachment #1: Type: text/plain, Size: 554 bytes --]

On Thu, Sep 25, 2025 at 05:00:07PM +0200, Johan Hovold wrote:
> Make sure to drop the reference taken to the ahb platform device when
> looking up its driver data while enabling the smmu.
> 
> Note that holding a reference to a device does not prevent its driver
> data from going away.
> 
> Fixes: 89c788bab1f0 ("ARM: tegra: Add SMMU enabler in AHB")
> Cc: stable@vger.kernel.org	# 3.5
> Signed-off-by: Johan Hovold <johan@kernel.org>
> ---
>  drivers/amba/tegra-ahb.c | 1 +
>  1 file changed, 1 insertion(+)

Applied, thanks.

Thierry

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

end of thread, other threads:[~2025-11-14 16:50 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-09-25 15:00 [PATCH] amba: tegra-ahb: fix device leak on smmu enable Johan Hovold
2025-09-26 19:35 ` Markus Elfring
2025-11-05  8:08 ` Johan Hovold
2025-11-14 16:50 ` Thierry Reding

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).