[PATCH] iommu/exynos: Disable runtime PM on registration failure

Robin Murphy robin.murphy at arm.com
Fri Nov 27 05:50:38 PST 2026


On 26/11/2026 4:52 am, 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.

If that matters, then wouldn't the same theoretical reasoning also still 
apply to module removal after a successful probe?

> 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>
> ---
>   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;

But what about other IOMMU instances that could have probed in parallel 
and already observed dma_dev to be set? Sure the existing code is not 
perfectly race-free to begin with, but this only makes the issue much 
more obviously worse.

Thanks,
Robin.

>   err_dma_set_mask:
>   	iommu_device_sysfs_remove(&data->iommu);
>   	return ret;
> 
> base-commit: ebb7a8dc1e74c705daffe11c2faf38ec2628f838




More information about the linux-arm-kernel mailing list