[PATCH] iommu/exynos: Disable runtime PM on registration failure
Marek Szyprowski
m.szyprowski at samsung.com
Wed Nov 25 23:52:43 PST 2026
On 26.11.2026 05:52, Zhiqi Zhang wrote:
> exynos_sysmmu_probe() enables runtime PM and then registers the SysMMU
> with the IOMMU core. If iommu_device_register() fails, the error path
> currently only removes the sysfs entry before returning.
>
> That leaves runtime PM enabled for a device whose probe failed. The same
> path can also leave dma_dev pointing at this SysMMU when it was the first
> one to initialize the global DMA helper device, so later domain allocation
> may use a device that never finished probing.
>
> Add an unwind label for iommu_device_register() failures. Disable runtime
> PM there, clear dma_dev if this probe set it, and then remove the sysfs
> entry as before.
>
> Found during static probe error-path review with help from OpenAI Codex.
> The fix was build-tested with ARCH=arm exynos_defconfig and W=1 using an
> arm-linux-gnueabihf GCC cross-compiler.
>
> Fixes: bbc4d205d93f ("iommu/exynos: Fix driver initialization sequence")
> Cc: stable at vger.kernel.org # 6.2+
> Signed-off-by: Zhiqi Zhang <zhiqizhangg at gmail.com>
In real world this doesn't happen, but anyway:
Acked-by: Marek Szyprowski <m.szyprowski at samsung.com>
> ---
> drivers/iommu/exynos-iommu.c | 6 +++++-
> 1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/iommu/exynos-iommu.c b/drivers/iommu/exynos-iommu.c
> index 7c337ba96..18a536008 100644
> --- a/drivers/iommu/exynos-iommu.c
> +++ b/drivers/iommu/exynos-iommu.c
> @@ -844,10 +844,14 @@ static int exynos_sysmmu_probe(struct platform_device *pdev)
>
> ret = iommu_device_register(&data->iommu, &exynos_iommu_ops, dev);
> if (ret)
> - goto err_dma_set_mask;
> + goto err_iommu_register;
>
> return 0;
>
> +err_iommu_register:
> + pm_runtime_disable(dev);
> + if (dma_dev == &pdev->dev)
> + dma_dev = NULL;
> err_dma_set_mask:
> iommu_device_sysfs_remove(&data->iommu);
> return ret;
>
> base-commit: ebb7a8dc1e74c705daffe11c2faf38ec2628f838
Best regards
--
Marek Szyprowski, PhD
Samsung R&D Institute Poland
More information about the linux-arm-kernel
mailing list