From: sashiko-bot@kernel.org
To: "Vikash Garodia" <vikash.garodia@oss.qualcomm.com>
Cc: robh@kernel.org, devicetree@vger.kernel.org,
media-ci@linuxtv.org, conor+dt@kernel.org
Subject: Re: [PATCH v2 09/12] arm64: dts: qcom: sm8550: Add Iris context bank subnodes
Date: Fri, 31 Jul 2026 18:38:09 +0000 [thread overview]
Message-ID: <20260731183809.ECD0F1F00AC4@smtp.kernel.org> (raw)
In-Reply-To: <20260731-vpu_iommu_iova_handling-v2-9-da52b5228dbd@oss.qualcomm.com>
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
Pre-existing issues:
- [High] In `of_iommu_get_resv_regions()`, the code fails to advance the `maps` pointer past a node's specifier cells if the node does not match `dev->of_node`, causing the parser to fall out of sync.
- [High] If `of_translate_dma_region()` fails to translate the address, it returns `NULL`, which is assigned to `maps` without a NULL check, leading to a guaranteed kernel panic on the next loop iteration.
--
--- Patch [9]: [PATCH v2 09/12] arm64: dts: qcom: sm8550: Add Iris context bank subnodes ---
commit d594fb5947e7e4fe6f238d480eadd3c2b7770369
Author: Vikash Garodia <vikash.garodia@oss.qualcomm.com>
arm64: dts: qcom: sm8550: Add Iris context bank subnodes
The VPU issues DMA through several SMMU streams, and the hardware does
not give every stream the same addressable range. The non-pixel stream
is restricted to use 0-600MB of IOVA space, while the pixel stream can
address the full range. This commit separates the streams into two
subnodes, pointing the non-pixel subnode to a reserved-memory node to
exclude the lower 600 MB from its IOVA allocator.
> diff --git a/arch/arm64/boot/dts/qcom/sm8550.dtsi b/arch/arm64/boot/dts/qcom/sm8550.dtsi
> index 7599b7b7e645f..4c8ad7f026fe5 100644
> --- a/arch/arm64/boot/dts/qcom/sm8550.dtsi
> +++ b/arch/arm64/boot/dts/qcom/sm8550.dtsi
> @@ -1087,6 +1087,10 @@ hyp_ext_reserved_mem: hyp-ext-reserved-region@ff700000 {
> reg = <0 0xff700000 0 0x100000>;
> no-map;
> };
> +
> + iris_resv: reservation-iris {
> + iommu-addresses = <&iris_non_pixel 0x0 0x0 0x0 0x25800000>;
[Severity: High]
This isn't a bug introduced by this patch, but adding this property exposes
a pre-existing issue in of_iommu_get_resv_regions().
If a memory-region specifies an iommu-addresses list with multiple devices,
the parsing breaks for all entries after the first one because the code fails
to advance the maps pointer past a node's specifier cells if the node does
not match dev->of_node:
drivers/iommu/of_iommu.c:of_iommu_get_resv_regions() {
...
if (np == dev->of_node) {
int prot = IOMMU_READ | IOMMU_WRITE;
...
}
...
}
There is no else branch to compute the specifier size and advance the maps
pointer over it. The next iteration incorrectly reads the first cell of the
specifier as the next phandle, throwing the parser out of sync.
Will this be an issue if additional devices are added to this list in the
future?
[Severity: High]
This is a pre-existing issue, but adding this property could trigger a kernel
panic if the device tree is ever misconfigured.
If of_translate_dma_region() fails to translate the address (for example,
due to a missing dma-ranges property), it returns NULL. This NULL is directly
assigned to maps without a check:
drivers/iommu/of_iommu.c:of_iommu_get_resv_regions() {
...
maps = of_translate_dma_region(np, maps, &iova, &length);
...
}
Because length is uninitialized, the loop eventually proceeds to the next
iteration where the condition while (maps < end) evaluates to true since maps
is NULL. Dereferencing maps with be32_to_cpup(maps++) then causes a kernel
panic.
Should we add a NULL check in of_iommu_get_resv_regions() to prevent this?
> + };
> };
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260731-vpu_iommu_iova_handling-v2-0-da52b5228dbd@oss.qualcomm.com?part=9
next prev parent reply other threads:[~2026-07-31 18:38 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
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 [this message]
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=20260731183809.ECD0F1F00AC4@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox