[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20251027153317.66454-1-linmq006@gmail.com>
Date: Mon, 27 Oct 2025 23:33:15 +0800
From: Miaoqian Lin <linmq006@...il.com>
To: Russell King <linux@...linux.org.uk>,
Thierry Reding <thierry.reding@...il.com>,
Jonathan Hunter <jonathanh@...dia.com>,
Stephen Warren <swarren@...dia.com>,
Hiroshi DOYU <hdoyu@...dia.com>,
linux-tegra@...r.kernel.org,
linux-kernel@...r.kernel.org
Cc: linmq006@...il.com,
stable@...r.kernel.org
Subject: [PATCH] amba: tegra-ahb: fix reference count leak in tegra_ahb_enable_smmu
The driver_find_device_by_of_node() function returns a device with its
reference count incremented. driver_find_device_by_of_node() is an inline
wrapper that calls driver_find_device(), which calls get_device(dev) and
returns the found device with an incremented reference count.
Fix this by adding the missing put_device() call after the device
operations are completed.
Found via static analysis.
Fixes: 89c788bab1f0 ("ARM: tegra: Add SMMU enabler in AHB")
Cc: stable@...r.kernel.org
Signed-off-by: Miaoqian Lin <linmq006@...il.com>
---
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..6c306d017b67 100644
--- a/drivers/amba/tegra-ahb.c
+++ b/drivers/amba/tegra-ahb.c
@@ -147,6 +147,7 @@ int tegra_ahb_enable_smmu(struct device_node *dn)
val = gizmo_readl(ahb, AHB_ARBITRATION_XBAR_CTRL);
val |= AHB_ARBITRATION_XBAR_CTRL_SMMU_INIT_DONE;
gizmo_writel(ahb, val, AHB_ARBITRATION_XBAR_CTRL);
+ put_device(dev);
return 0;
}
EXPORT_SYMBOL(tegra_ahb_enable_smmu);
--
2.39.5 (Apple Git-154)
Powered by blists - more mailing lists