[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20251027013807.25214-1-make24@iscas.ac.cn>
Date: Mon, 27 Oct 2025 09:38:07 +0800
From: Ma Ke <make24@...as.ac.cn>
To: linux@...linux.org.uk,
thierry.reding@...il.com,
jonathanh@...dia.com,
make24@...as.ac.cn,
hdoyu@...dia.com,
swarren@...dia.com
Cc: linux-tegra@...r.kernel.org,
linux-kernel@...r.kernel.org,
akpm@...ux-foundation.org,
stable@...r.kernel.org
Subject: [PATCH] ARM: tegra: fix device leak on tegra ahb lookup
tegra_ahb_enable_smmu() utilizes driver_find_device_by_of_node() which
internally calls driver_find_device() to locate the matching device.
driver_find_device() increments the ref count of the found device by
calling get_device(), but tegra_ahb_enable_smmu() fails to call
put_device() to decrement the reference count before returning. This
results in a reference count leak of the device, which may prevent the
device from being properly released and cause a memory leak.
Found by code review.
Cc: stable@...r.kernel.org
Fixes: 89c788bab1f0 ("ARM: tegra: Add SMMU enabler in AHB")
Signed-off-by: Ma Ke <make24@...as.ac.cn>
---
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.17.1
Powered by blists - more mailing lists