Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Marek Szyprowski <m.szyprowski@samsung.com>
To: Zhiqi Zhang <zhiqizhangg@gmail.com>,
	Joerg Roedel <joro@8bytes.org>, Will Deacon <will@kernel.org>
Cc: Robin Murphy <robin.murphy@arm.com>,
	Krzysztof Kozlowski <krzk@kernel.org>,
	Peter Griffin <peter.griffin@linaro.org>,
	Alim Akhtar <alim.akhtar@samsung.com>,
	Sam Protsenko <semen.protsenko@linaro.org>,
	iommu@lists.linux.dev, linux-arm-kernel@lists.infradead.org,
	linux-samsung-soc@vger.kernel.org, stable@vger.kernel.org
Subject: Re: [PATCH] iommu/exynos: Disable runtime PM on registration failure
Date: Thu, 26 Nov 2026 08:52:43 +0100	[thread overview]
Message-ID: <27eac3a7-d5d3-4d29-a38f-8d22a3faf504@samsung.com> (raw)
In-Reply-To: <20261126045203.62181-1-zhiqizhangg@gmail.com>

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@vger.kernel.org # 6.2+
> Signed-off-by: Zhiqi Zhang <zhiqizhangg@gmail.com>

In real world this doesn't happen, but anyway:

Acked-by: Marek Szyprowski <m.szyprowski@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



  reply	other threads:[~2026-11-26  7:53 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20261126045219eucas1p11712605a6aec839075da6ff9bc9dfe15@eucas1p1.samsung.com>
2026-11-26  4:52 ` [PATCH] iommu/exynos: Disable runtime PM on registration failure Zhiqi Zhang
2026-11-26  7:52   ` Marek Szyprowski [this message]
2026-11-27 13:50   ` Robin Murphy
2026-11-30  9:45   ` Joerg Roedel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=27eac3a7-d5d3-4d29-a38f-8d22a3faf504@samsung.com \
    --to=m.szyprowski@samsung.com \
    --cc=alim.akhtar@samsung.com \
    --cc=iommu@lists.linux.dev \
    --cc=joro@8bytes.org \
    --cc=krzk@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-samsung-soc@vger.kernel.org \
    --cc=peter.griffin@linaro.org \
    --cc=robin.murphy@arm.com \
    --cc=semen.protsenko@linaro.org \
    --cc=stable@vger.kernel.org \
    --cc=will@kernel.org \
    --cc=zhiqizhangg@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox