From: sashiko-bot@kernel.org
To: "Vikash Garodia" <vikash.garodia@oss.qualcomm.com>
Cc: devicetree@vger.kernel.org, robh@kernel.org, conor+dt@kernel.org,
media-ci@linuxtv.org
Subject: Re: [PATCH v2 06/12] media: iris: Skip DMA mask setup when the core device has no IOMMU
Date: Fri, 31 Jul 2026 18:43:49 +0000 [thread overview]
Message-ID: <20260731184349.A7ADE1F00AC4@smtp.kernel.org> (raw)
In-Reply-To: <20260731-vpu_iommu_iova_handling-v2-6-da52b5228dbd@oss.qualcomm.com>
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
New issues:
- [High] Silent DMA allocation fallback causing hardware breakage on updated device trees.
Pre-existing issues:
- [High] Race condition exposing uninitialized device leading to NULL pointer dereference or DMA misconfiguration.
--
--- Patch [6]: [PATCH v2 06/12] media: iris: Skip DMA mask setup when the core device has no IOMMU ---
commit 91265093c9bc3bb22f1e175614f1dde24649bf5b
Author: Vikash Garodia <vikash.garodia@oss.qualcomm.com>
media: iris: Skip DMA mask setup when the core device has no IOMMU
This commit skips calling dma_set_mask_and_coherent() on the parent iris
device if it has no IOMMU mapped. It sets the DMA mask only when
device_iommu_mapped() reports an IOMMU on the core device, preventing
probe failures on newer platforms where "iommus" is on context bank subnodes.
Cc: stable@vger.kernel.org
> diff --git a/drivers/media/platform/qcom/iris/iris_probe.c b/drivers/media/platform/qcom/iris/iris_probe.c
> index 2594f5a67378a..c40c4ec44e83e 100644
> --- a/drivers/media/platform/qcom/iris/iris_probe.c
> +++ b/drivers/media/platform/qcom/iris/iris_probe.c
> @@ -310,9 +310,11 @@ static int iris_probe(struct platform_device *pdev)
>
> dma_mask = core->iris_platform_data->dma_mask;
>
> - ret = dma_set_mask_and_coherent(dev, dma_mask);
> - if (ret)
> - goto err_vdev_unreg_enc;
> + if (device_iommu_mapped(dev)) {
> + ret = dma_set_mask_and_coherent(dev, dma_mask);
> + if (ret)
> + goto err_vdev_unreg_enc;
> + }
[Severity: High]
Does this change introduce a silent DMA allocation fallback that could
cause SMMU faults or memory corruption at runtime?
If the new device tree bindings are used (where the "iommus" property is
moved to context bank subnodes), device_iommu_mapped(dev) returns false
and probe skips dma_set_mask_and_coherent().
However, if no platform actually implements the .init_cb_devs hook,
iris_init_cb_devs() will silently return success without creating the
context bank subdevices:
drivers/media/platform/qcom/iris/iris_probe.c:iris_init_cb_devs() {
if (core->iris_platform_data->vpu_ops->init_cb_devs)
return core->iris_platform_data->vpu_ops->init_cb_devs(core);
return 0;
}
When DMA allocations occur, iris_get_cb_dev() falls back to the parent
core device which now has no IOMMU and an unconfigured DMA mask:
drivers/media/platform/qcom/iris/iris_resources.c:iris_get_cb_dev() {
...
return dev ? dev : core->dev;
}
[Severity: High]
This isn't a bug introduced by this patch, but there is a race condition
where device nodes are exposed to userspace before critical hardware setup
like DMA masks and PM runtime initialization occurs.
Earlier in iris_probe(), the video devices are registered:
drivers/media/platform/qcom/iris/iris_probe.c:iris_probe() {
...
ret = iris_register_video_device(core, DECODER);
...
ret = iris_register_video_device(core, ENCODER);
...
}
Inside iris_register_video_device(), video_register_device() makes the
device accessible to userspace before video_set_drvdata() sets the driver
data:
drivers/media/platform/qcom/iris/iris_probe.c:iris_register_video_device() {
...
ret = video_register_device(vdev, VFL_TYPE_VIDEO, -1);
if (ret)
goto err_vdev_release;
video_set_drvdata(vdev, core);
...
}
If a userspace application like udev immediately opens the device,
iris_open() will retrieve a NULL pointer and trigger a NULL pointer
dereference when accessing core->dev:
drivers/media/platform/qcom/iris/iris_vidc.c:iris_open() {
struct iris_core *core = video_drvdata(filp);
...
ret = pm_runtime_resume_and_get(core->dev);
...
}
Even if video_set_drvdata() completes in time, iris_probe() registers the
video devices before executing dma_set_mask_and_coherent() and
devm_pm_runtime_enable(). Could this allow iris_open() to initiate PM/DMA
operations on an uninitialized hardware state?
>
> dma_set_max_seg_size(&pdev->dev, DMA_BIT_MASK(32));
> dma_set_seg_boundary(&pdev->dev, DMA_BIT_MASK(32));
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260731-vpu_iommu_iova_handling-v2-0-da52b5228dbd@oss.qualcomm.com?part=6
next prev parent reply other threads:[~2026-07-31 18:43 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-31 18:22 [PATCH v2 00/12] media: iris: Migrate iommus to iris sub nodes Vikash Garodia
2026-07-31 18:22 ` [PATCH v2 01/12] dt-bindings: media: qcom,venus: Add context bank subnodes to common schema Vikash Garodia
2026-07-31 18:36 ` sashiko-bot
2026-07-31 18:22 ` [PATCH v2 02/12] dt-bindings: media: qcom,sm8550-iris: Add context bank subnodes Vikash Garodia
2026-07-31 18:31 ` sashiko-bot
2026-07-31 20:36 ` Rob Herring (Arm)
2026-07-31 18:22 ` [PATCH v2 03/12] media: iris: Add platform hooks for context bank device setup Vikash Garodia
2026-07-31 18:36 ` sashiko-bot
2026-07-31 18:22 ` [PATCH v2 04/12] media: iris: Add helper to create a context bank device Vikash Garodia
2026-07-31 18:22 ` [PATCH v2 05/12] media: iris: Route buffers to the matching " Vikash Garodia
2026-07-31 18:57 ` sashiko-bot
2026-07-31 18:22 ` [PATCH v2 06/12] media: iris: Skip DMA mask setup when the core device has no IOMMU Vikash Garodia
2026-07-31 18:43 ` sashiko-bot [this message]
2026-07-31 18:22 ` [PATCH v2 07/12] media: iris: Create pixel and non-pixel context banks on VPU3x Vikash Garodia
2026-07-31 18:41 ` sashiko-bot
2026-07-31 18:22 ` [PATCH v2 08/12] arm64: dts: qcom: hamoa: Add Iris context bank subnodes Vikash Garodia
2026-07-31 18:22 ` [PATCH v2 09/12] arm64: dts: qcom: sm8550: " Vikash Garodia
2026-07-31 18:38 ` sashiko-bot
2026-07-31 18:22 ` [PATCH v2 10/12] arm64: dts: qcom: lemans: " Vikash Garodia
2026-07-31 18:22 ` [PATCH v2 11/12] arm64: dts: qcom: monaco: " Vikash Garodia
2026-07-31 18:22 ` [PATCH v2 12/12] arm64: dts: qcom: sm8650: " Vikash Garodia
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=20260731184349.A7ADE1F00AC4@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=media-ci@linuxtv.org \
--cc=robh@kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=vikash.garodia@oss.qualcomm.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.