]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
iommu/sun50i: fix device leak on of_xlate()
authorJohan Hovold <johan@kernel.org>
Mon, 20 Oct 2025 04:53:17 +0000 (06:53 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 8 Jan 2026 09:14:40 +0000 (10:14 +0100)
commit f916109bf53864605d10bf6f4215afa023a80406 upstream.

Make sure to drop the reference taken to the iommu platform device when
looking up its driver data during of_xlate().

Fixes: 4100b8c229b3 ("iommu: Add Allwinner H6 IOMMU driver")
Cc: stable@vger.kernel.org # 5.8
Cc: Maxime Ripard <mripard@kernel.org>
Acked-by: Robin Murphy <robin.murphy@arm.com>
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/iommu/sun50i-iommu.c

index 8d8f11854676c055d5398af893453aa53b499750..a27cbc761e26e7deebe54101855ce3d0a6d1765f 100644 (file)
@@ -837,6 +837,8 @@ static int sun50i_iommu_of_xlate(struct device *dev,
 
        dev_iommu_priv_set(dev, platform_get_drvdata(iommu_pdev));
 
+       put_device(&iommu_pdev->dev);
+
        return iommu_fwspec_add_ids(dev, &id, 1);
 }