Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

iommu/tegra: fix device leak on probe_device()

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

Note that commit 9826e393e4a8 ("iommu/tegra-smmu: Fix missing
put_device() call in tegra_smmu_find") fixed the leak in an error path,
but the reference is still leaking on success.

Fixes: 891846516317 ("memory: Add NVIDIA Tegra memory controller support")
Cc: stable@vger.kernel.org # 3.19: 9826e393e4a8
Cc: Miaoqian Lin <linmq006@gmail.com>
Acked-by: Robin Murphy <robin.murphy@arm.com>
Acked-by: Thierry Reding <treding@nvidia.com>
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>

authored by

Johan Hovold and committed by
Joerg Roedel
c08934a6 f916109b

+2 -3
+2 -3
drivers/iommu/tegra-smmu.c
··· 830 830 return NULL; 831 831 832 832 mc = platform_get_drvdata(pdev); 833 - if (!mc) { 834 - put_device(&pdev->dev); 833 + put_device(&pdev->dev); 834 + if (!mc) 835 835 return NULL; 836 - } 837 836 838 837 return mc->smmu; 839 838 }