* [PATCH] iommu/rockchip: Fix device reference leak in rk_iommu_of_xlate()
@ 2026-11-12 2:18 Xiangwu Lai
2026-12-01 7:47 ` Xiangwu Lai
0 siblings, 1 reply; 3+ messages in thread
From: Xiangwu Lai @ 2026-11-12 2:18 UTC (permalink / raw)
To: joro, will
Cc: robin.murphy, heiko, iommu, linux-rockchip, linux-kernel, Xiangwu Lai
rk_iommu_of_xlate() takes a reference on the IOMMU platform device
with of_find_device_by_node(), but when the subsequent per-device
data allocation fails the reference is only dropped on the success
path, so the error path leaks it on every client device whose DT
translation hits the allocation failure. The platform device is
also dereferenced without a NULL check.
Check the platform device and release the reference on the
allocation failure path.
Fixes: f48dcda8f6a4 ("iommu/rockchip: Allocate per-device data sensibly")
Signed-off-by: Xiangwu Lai <laixiangwu@cmss.chinamobile.com>
---
drivers/iommu/rockchip-iommu.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/drivers/iommu/rockchip-iommu.c b/drivers/iommu/rockchip-iommu.c
index 21af2f621..793cbdd6d 100644
--- a/drivers/iommu/rockchip-iommu.c
+++ b/drivers/iommu/rockchip-iommu.c
@@ -1185,10 +1185,14 @@ static int rk_iommu_of_xlate(struct device *dev,
struct rk_iommudata *data;
iommu_dev = of_find_device_by_node(args->np);
+ if (!iommu_dev)
+ return -ENODEV;
data = devm_kzalloc(&iommu_dev->dev, sizeof(*data), GFP_KERNEL);
- if (!data)
+ if (!data) {
+ platform_device_put(iommu_dev);
return -ENOMEM;
+ }
data->iommu = platform_get_drvdata(iommu_dev);
dev_iommu_priv_set(dev, data);
--
2.50.1.windows.1
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] iommu/rockchip: Fix device reference leak in rk_iommu_of_xlate()
2026-11-12 2:18 [PATCH] iommu/rockchip: Fix device reference leak in rk_iommu_of_xlate() Xiangwu Lai
@ 2026-12-01 7:47 ` Xiangwu Lai
2026-12-01 10:34 ` Jörg Rödel
0 siblings, 1 reply; 3+ messages in thread
From: Xiangwu Lai @ 2026-12-01 7:47 UTC (permalink / raw)
To: joro, will
Cc: Xiangwu Lai, robin.murphy, heiko, iommu, linux-rockchip, linux-kernel
Hello Joerg, Will,
A gentle ping on this patch, sent three weeks ago on Nov 12:
iommu/rockchip: Fix device reference leak in rk_iommu_of_xlate()
https://lore.kernel.org/all/20261112021845.1867-1-laixiangwu@cmss.chinamobile.com/
rk_iommu_of_xlate() takes a reference on the IOMMU platform device with
of_find_device_by_node(), but when the per-device data allocation fails
the error path returns without dropping it, so every client device whose
DT translation hits the allocation failure leaks the reference.
Is there anything blocking this patch, or does it just need more time?
Thanks,
Xiangwu Lai
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] iommu/rockchip: Fix device reference leak in rk_iommu_of_xlate()
2026-12-01 7:47 ` Xiangwu Lai
@ 2026-12-01 10:34 ` Jörg Rödel
0 siblings, 0 replies; 3+ messages in thread
From: Jörg Rödel @ 2026-12-01 10:34 UTC (permalink / raw)
To: Xiangwu Lai
Cc: will, robin.murphy, heiko, iommu, linux-rockchip, linux-kernel
On Tue, Dec 01, 2026 at 03:47:47PM +0800, Xiangwu Lai wrote:
> A gentle ping on this patch, sent three weeks ago on Nov 12:
The patch does not even apply to 7.4-rc4. Please fix it up and re-submit.
-Joerg
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-12-01 10:34 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-12 2:18 [PATCH] iommu/rockchip: Fix device reference leak in rk_iommu_of_xlate() Xiangwu Lai
2026-12-01 7:47 ` Xiangwu Lai
2026-12-01 10:34 ` Jörg Rödel
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®