Thank you for your contribution! Sashiko AI review found 3 potential issue(s) to consider:
Pre-existing issues:
- [Critical] In `iris_vdec_inst_init`, the memory allocations for `fmt_src` and `fmt_dst` are not checked for failure, leading to an immediate NULL pointer dereference on allocation failure.
- [High] The `fmt_src` and `fmt_dst` allocations are leaked if initialization fails during `iris_open` or at the end of the inst_init functions.
- [High] Use-After-Free of `struct iris_core` due to `devm_kzalloc` mismatch with V4L2 file descriptor lifetimes.
--
--- Patch [5]: [PATCH v2 05/12] media: iris: Route buffers to the matching context bank device ---
commit 727c95dcb8829de9509a16605cf4666c250086ac
Author: Vikash Garodia <vikash.garodia(a)oss.qualcomm.com>
media: iris: Route buffers to the matching context bank device
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.
> diff --git a/drivers/media/platform/qcom/iris/iris_vidc.c b/drivers/media/platform/qcom/iris/iris_vidc.c
> index 14d63dc76c9ba..26df872fb4fa1 100644
> --- a/drivers/media/platform/qcom/iris/iris_vidc.c
> +++ b/drivers/media/platform/qcom/iris/iris_vidc.c
[ ... ]
While reviewing this driver, I noticed a few pre-existing regressions in
the related code that might need attention:
In drivers/media/platform/qcom/iris/iris_vdec.c:iris_vdec_inst_init():
> inst->fmt_src = kzalloc_obj(*inst->fmt_src);
> inst->fmt_dst = kzalloc_obj(*inst->fmt_dst);
>
> inst->fw_min_count = 0;
>
> f = inst->fmt_src;
> f->type = V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE;
[Severity: Critical]
This isn't a bug introduced by this patch, but could kzalloc_obj() return
a null pointer under memory pressure and cause a dereference when setting
f->type?
In drivers/media/platform/qcom/iris/iris_vidc.c:iris_open():
> fail_m2m_ctx_release:
> v4l2_m2m_ctx_release(inst->m2m_ctx);
> fail_m2m_release:
> v4l2_m2m_release(inst->m2m_dev);
> fail_v4l2_fh_deinit:
> iris_v4l2_fh_deinit(inst, filp);
> mutex_destroy(&inst->ctx_q_lock);
> mutex_destroy(&inst->lock);
> kfree(inst);
>
> return ret;
[Severity: High]
This isn't a bug introduced by this patch, but does this error path leave
the memory allocated for inst->fmt_src and inst->fmt_dst leaked?
In drivers/media/platform/qcom/iris/iris_probe.c:iris_probe():
> core = devm_kzalloc(&pdev->dev, sizeof(*core), GFP_KERNEL);
[Severity: High]
This isn't a bug introduced by this patch, but since core is allocated with
devm_kzalloc, its lifetime is tied to device binding.
If the driver is unbound but a file descriptor remains open, can a
subsequent close() lead to a use-after-free?
For example, when iris_check_num_queued_internal_buffers() is called
during close:
> const struct iris_firmware_data *firmware_data = inst->core->iris_firmware_data;
Could inst->core have already been freed by devres at this point?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260731-vpu_iommu_iova_handling-v2-0-da52b5…
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(a)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(a)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-da52b5…
Thank you for your contribution! Sashiko AI review found 3 potential issue(s) to consider:
New issues:
- [High] Unregistered and freed platform devices (p_dev, np_dev) can be used by concurrent ioctls during driver removal, leading to Use-After-Free.
- [High] Context bank platform devices are missing DMA configuration, causing fatal SMMU faults.
Pre-existing issues:
- [High] Missing cancellation of delayed work sys_error_handler causes Use-After-Free on module removal.
--
--- Patch [7]: [PATCH v2 07/12] media: iris: Create pixel and non-pixel context banks on VPU3x ---
commit 6bf8596f13d0c7afe5ee94339e572204b2a9c6df
Author: Vikash Garodia <vikash.garodia(a)oss.qualcomm.com>
media: iris: Create pixel and non-pixel context banks on VPU3x
This commit implements context bank hooks for VPU3x to create "non-pixel"
and "pixel" devices from matching device tree subnodes. It wires these hooks
into the ops for relevant platforms and handles device registration and
unregistration.
> diff --git a/drivers/media/platform/qcom/iris/iris_vpu3x.c b/drivers/media/platform/qcom/iris/iris_vpu3x.c
> index 3dad47be78b58..623a0f8a7982c 100644
> --- a/drivers/media/platform/qcom/iris/iris_vpu3x.c
> +++ b/drivers/media/platform/qcom/iris/iris_vpu3x.c
[ ... ]
> @@ -254,6 +254,40 @@ static void iris_vpu35_power_off_hw(struct iris_core *core)
[ ... ]
> +static int iris_vpu3x_init_cb_devs(struct iris_core *core)
> +{
> + struct device *dev;
> +
> + dev = iris_create_cb_dev(core, "non-pixel");
[Severity: High]
Does this new device need explicit DMA configuration?
Since iris_create_cb_dev() creates dummy platform devices for the IOMMU
context banks without a driver, the kernel driver core never calls
really_probe() and never invokes platform_dma_configure(). Without an
explicit call to of_dma_configure() in the driver, the device lacks an IOMMU
domain.
When iris_get_cb_dev() returns these devices for buffer allocation, will the
DMA API return raw physical addresses instead of IOVA, triggering an IOMMU
context fault when the VPU's enabled SMMU streams access this memory?
> + if (IS_ERR(dev))
> + return PTR_ERR(dev);
> +
> + core->np_dev = dev;
> +
> + dev = iris_create_cb_dev(core, "pixel");
> + if (IS_ERR(dev))
> + goto unreg_np_dev;
> +
> + core->p_dev = dev;
> +
> + return 0;
> +
> +unreg_np_dev:
> + if (core->np_dev)
> + platform_device_unregister(to_platform_device(core->np_dev));
> + core->np_dev = NULL;
> +
> + return PTR_ERR(dev);
> +}
> +
> +static void iris_vpu3x_deinit_cb_devs(struct iris_core *core)
> +{
> + if (core->p_dev)
> + platform_device_unregister(to_platform_device(core->p_dev));
> + if (core->np_dev)
> + platform_device_unregister(to_platform_device(core->np_dev));
[Severity: High]
Can concurrent ioctls access these devices after they are unregistered?
If iris_remove() is called while userspace holds a file descriptor open and
executes an ioctl (like VIDIOC_QBUF), this function unregisters and frees
p_dev and np_dev. The pointers in core are not cleared, and there doesn't
appear to be synchronization with active file handles.
Could a concurrent ioctl call iris_get_cb_dev(), retrieve the freed p_dev or
np_dev pointer, and pass it to the DMA API, resulting in a use-after-free of
the device structure?
> +}
[Severity: High]
This isn't a bug introduced by this patch, but does the module removal path
leave delayed work running?
Looking at the removal path, iris_remove() destroys the lock and exits without
cancelling the sys_error_handler delayed work:
drivers/media/platform/qcom/iris/iris_probe.c:iris_remove() {
...
mutex_destroy(&core->lock);
}
If a hardware error schedules core->sys_error_handler with a delay, and
iris_remove() executes immediately after, the devres manager frees the core
structure. When the delayed work executes, it will call
iris_sys_error_handler(), attempting to access the freed core memory.
Should cancel_delayed_work_sync() be called during removal to prevent a
use-after-free of the core structure?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260731-vpu_iommu_iova_handling-v2-0-da52b5…
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(a)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-da52b5…
Thank you for your contribution! Sashiko AI review found 4 potential issue(s) to consider:
Pre-existing issues:
- [High] V4L2 state object `core` is allocated with `devm_kzalloc`, leading to UAF if file descriptors are kept open after device unbind.
- [High] Hardware deinitialization occurs before video devices are unregistered, allowing a race with new `open()` calls.
- [High] Video device exposed to userspace before driver data is fully initialized, causing a TOCTOU race condition.
- [High] The `sys_error_handler` delayed work is never explicitly cancelled during module removal, leading to a potential Use-After-Free.
--
--- Patch [3]: [PATCH v2 03/12] media: iris: Add platform hooks for context bank device setup ---
commit a925a8b5dc58a6c33e49594b0c98c79bb206b111
Author: Vikash Garodia <vikash.garodia(a)oss.qualcomm.com>
media: iris: Add platform hooks for context bank device setup
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. Keeping each stream inside its own range needs a
separate IOMMU domain per stream, which in turn needs a separate struct
device per stream, since the IOMMU core attaches a domain per device.
> diff --git a/drivers/media/platform/qcom/iris/iris_probe.c b/drivers/media/platform/qcom/iris/iris_probe.c
> index c2dcb50a27824..2594f5a67378a 100644
> --- a/drivers/media/platform/qcom/iris/iris_probe.c
> +++ b/drivers/media/platform/qcom/iris/iris_probe.c
[ ... ]
> @@ -150,6 +151,20 @@ static int iris_init_resources(struct iris_core *core)
> return iris_init_resets(core);
> }
>
> +static int iris_init_cb_devs(struct iris_core *core)
> +{
> + if (core->iris_platform_data->vpu_ops->init_cb_devs)
> + return core->iris_platform_data->vpu_ops->init_cb_devs(core);
> +
> + return 0;
> +}
> +
> +static void iris_deinit_cb_devs(struct iris_core *core)
> +{
> + if (core->iris_platform_data->vpu_ops->deinit_cb_devs)
> + core->iris_platform_data->vpu_ops->deinit_cb_devs(core);
> +}
> +
> static int iris_register_video_device(struct iris_core *core, enum domain_type type)
> {
[Severity: High]
This isn't a bug introduced by this patch, but is it possible for userspace
to open the device before the driver data is fully initialized?
Looking at iris_register_video_device(), video_register_device() is called
before video_set_drvdata():
ret = video_register_device(vdev, VFL_TYPE_VIDEO, -1);
if (ret)
goto err_vdev_release;
video_set_drvdata(vdev, core);
If a rapid concurrent open() happens from userspace, iris_open() will be
invoked. It will call video_drvdata(filp) which returns NULL, and then
attempt pm_runtime_resume_and_get(core->dev), resulting in a NULL pointer
dereference.
[ ... ]
> @@ -207,6 +222,8 @@ static void iris_remove(struct platform_device *pdev)
>
> v4l2_device_unregister(&core->v4l2_dev);
>
> + iris_deinit_cb_devs(core);
> +
> mutex_destroy(&core->lock);
> }
[Severity: High]
This is a pre-existing issue, but does this teardown sequence leave a race
condition with new open() calls?
In iris_remove(), the driver unloads firmware and powers off the VPU via
iris_core_deinit(core) before video_unregister_device() is called.
If a concurrent open() happens before the video devices are unregistered,
iris_open() will call iris_core_init(core), powering the hardware back on.
Once iris_remove() finishes and returns, the device is unbound and core is
freed, but the hardware is erroneously left powered on, which can corrupt
the system state.
[Severity: High]
This is another pre-existing issue, but can the sys_error_handler delayed
work execute after the device is unbound?
The delayed work sys_error_handler is scheduled on HFI/hardware errors, but
it is never explicitly cancelled during module removal.
If a fatal hardware error triggers an interrupt just before or during
unbind, the work could be scheduled. When iris_remove() finishes, core is
freed by the devres subsystem. The delayed work will then run,
dereferencing the freed memory. Is a call to cancel_delayed_work_sync()
needed here?
[ ... ]
> @@ -273,10 +290,14 @@ static int iris_probe(struct platform_device *pdev)
>
> iris_session_init_caps(core);
>
> - ret = v4l2_device_register(dev, &core->v4l2_dev);
> + ret = iris_init_cb_devs(core);
> if (ret)
> return ret;
>
> + ret = v4l2_device_register(dev, &core->v4l2_dev);
> + if (ret)
> + goto err_cb_deinit;
> +
[Severity: High]
This is a pre-existing issue, but is the V4L2 state object core safely
managed if file descriptors are kept open after device unbind?
The core structure is allocated with devm_kzalloc() in iris_probe(),
meaning it will be automatically freed when the device is unbound via
sysfs.
However, if a userspace process currently holds an open file descriptor,
the character device stays alive. Calling close() or an ioctl() later will
invoke driver callbacks (like iris_close()) which dereference inst->core,
resulting in a use-after-free crash since the memory was already freed by
device resource management.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260731-vpu_iommu_iova_handling-v2-0-da52b5…
Thank you for your contribution! Sashiko AI review found 3 potential issue(s) to consider:
- [High] The newly defined context bank subnodes are entirely inaccessible to the targeted `sm8550-iris` platform.
- [Medium] Missing required properties in the common schema's subnode validation block.
- [Medium] Schema validation conflict for migrated child schemas due to unconditionally required `iommus` property.
--
--- Patch [1]: [PATCH v2 01/12] dt-bindings: media: qcom,venus: Add context bank subnodes to common schema ---
commit f7ccdc698c2e9a5f1a41568fd6c456d9da607bec
Author: Vikash Garodia <vikash.garodia(a)oss.qualcomm.com>
dt-bindings: media: qcom,venus: Add context bank subnodes to common schema
This commit describes each VPU SMMU stream as its own context bank subnode
to associate it with its reachable IOVA range. It adds non-pixel, pixel,
and video-firmware to the common schema, replacing the single iommus
property approach.
> diff --git a/Documentation/devicetree/bindings/media/qcom,sc7180-venus.yaml b/Documentation/devicetree/bindings/media/qcom,sc7180-venus.yaml
> index b21bed3148484..bfd8b1ad47312 100644
> --- a/Documentation/devicetree/bindings/media/qcom,sc7180-venus.yaml
> +++ b/Documentation/devicetree/bindings/media/qcom,sc7180-venus.yaml
[ ... ]
> @@ -91,21 +91,6 @@ properties:
> deprecated: true
> additionalProperties: false
>
> - video-firmware:
> - type: object
> - additionalProperties: false
> -
> - description: |
> - Firmware subnode is needed when the platform does not
> - have TrustZone.
> -
> - properties:
> - iommus:
> - maxItems: 1
> -
> - required:
> - - iommus
> -
> required:
> - compatible
> - power-domain-names
[Severity: Medium]
Does the unconditionally required iommus property in this file break migrations?
Since the common schema makes iommus optional when the new subnodes are
present via a oneOf block, if a platform like sc7180 is migrated to use the
new subnode layout (dropping the parent iommus), it will fail
make dt_binding_check because qcom,sc7180-venus.yaml still unconditionally
mandates iommus in its local required list.
> diff --git a/Documentation/devicetree/bindings/media/qcom,venus-common.yaml b/Documentation/devicetree/bindings/media/qcom,venus-common.yaml
> index 59a3fde846d21..ccae41bed757b 100644
> --- a/Documentation/devicetree/bindings/media/qcom,venus-common.yaml
> +++ b/Documentation/devicetree/bindings/media/qcom,venus-common.yaml
> @@ -47,6 +47,50 @@ properties:
> minItems: 1
> maxItems: 4
>
> + dma-ranges: true
> +
> + #address-cells:
> + const: 2
> +
> + #size-cells:
> + const: 2
> +
> + non-pixel:
[Severity: High]
Are these newly defined context bank subnodes accessible to the targeted
sm8550-iris platform?
The commit message notes this limitation applies to every VPU generation and
specifically mentions fixing an issue on sm8550. However,
qcom,sm8550-iris.yaml does not appear to include a $ref to
qcom,venus-common.yaml and sets unevaluatedProperties: false.
Would adding non-pixel or pixel subnodes to the sm8550 device tree result in
an immediate validation failure because the properties are undeclared in the
iris schema?
[ ... ]
> @@ -55,4 +99,11 @@ required:
> - memory-region
> - power-domains
>
> +oneOf:
> + - required:
> + - iommus
> + - required:
> + - non-pixel
> + - pixel
[Severity: Medium]
Should #address-cells, #size-cells, and dma-ranges be enforced here when the
subnodes are used?
The commit message explains that adding the subnodes requires these supporting
properties on the parent video-codec node. Without enforcing them in this
oneOf block alongside non-pixel and pixel, device trees can omit these
properties and still pass validation.
Could this cause of_translate_dma_region() to fail or return incorrect IOVAs
at runtime if the properties are omitted?
> +
> additionalProperties: true
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260731-vpu_iommu_iova_handling-v2-0-da52b5…
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] The schema fails to require `#address-cells`, `#size-cells`, and `dma-ranges` on the parent node when the `non-pixel` and `pixel` subnodes are used.
--
--- Patch [2]: [PATCH v2 02/12] dt-bindings: media: qcom,sm8550-iris: Add context bank subnodes ---
commit ba9132c7e393d239aeadc5fc3b8d92905c2ec775
Author: Vikash Garodia <vikash.garodia(a)oss.qualcomm.com>
dt-bindings: media: qcom,sm8550-iris: Add context bank subnodes
This commit updates the sm8550-iris device tree binding to support per-stream
context bank subnodes by referencing qcom,venus-common.yaml. It drops the flat
"iommus" property from the required list and updates the example to use the new
"non-pixel" and "pixel" subnodes along with their supporting bus properties.
> diff --git a/Documentation/devicetree/bindings/media/qcom,sm8550-iris.yaml b/Documentation/devicetree/bindings/media/qcom,sm8550-iris.yaml
> index 0400ca1bff05d..3d8ff5677bd4f 100644
> --- a/Documentation/devicetree/bindings/media/qcom,sm8550-iris.yaml
> +++ b/Documentation/devicetree/bindings/media/qcom,sm8550-iris.yaml
> @@ -98,10 +98,10 @@ required:
> - interconnect-names
> - resets
> - reset-names
> - - iommus
> - dma-coherent
>
> allOf:
> + - $ref: qcom,venus-common.yaml#
[Severity: Medium]
When referencing qcom,venus-common.yaml to support the new non-pixel and
pixel subnodes, is it possible for incomplete device trees to silently pass
validation?
In Documentation/devicetree/bindings/media/qcom,venus-common.yaml, the oneOf
check requires the non-pixel and pixel subnodes:
- required:
- non-pixel
- pixel
However, it doesn't appear to enforce the presence of #address-cells,
#size-cells, and dma-ranges on the parent node when those subnodes are used.
If a device tree writer implements the new subnode configuration but forgets
to include these supporting bus properties in the parent node, could this
defective configuration pass dt_binding_check and dtbs_check, ultimately
leading to the DMA translation failures and SMMU page faults described in
the commit message?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260731-vpu_iommu_iova_handling-v2-0-da52b5…
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [High] Incorrect check of `pm_runtime_get_if_in_use()` return value leads to an unbalanced decrement of the runtime PM usage counter when runtime PM is disabled.
- [Medium] Claimed dynamic frame windowing is unreachable dead code due to fixed formats and a missing `.set_selection` pad operation.
--
--- Patch [2]: [PATCH v11 2/2] media: i2c: Add driver for AMS-OSRAM Mira220 ---
commit 77f5d42d3080baefabb9e7bc7b1e2214656823e4
Author: Philippe Baetens <philippebaetens(a)gmail.com>
media: i2c: Add driver for AMS-OSRAM Mira220
Add a V4L2 subdev driver for driver for the AMS-OSRAM Mira220 image sensor.
The driver implements support for mono and RGB 12, 10 and 8 bits formats.
> diff --git a/drivers/media/i2c/mira220.c b/drivers/media/i2c/mira220.c
> new file mode 100644
> --- /dev/null
> +++ b/drivers/media/i2c/mira220.c
[ ... ]
> +static int mira220_set_ctrl(struct v4l2_ctrl *ctrl)
> +{
[ ... ]
> + /* Update the format code to adjust it to the new flip state. */
> + if (ctrl->id == V4L2_CID_VFLIP || ctrl->id == V4L2_CID_HFLIP)
> + format->code = mira220_get_format_code(mira220, format->code);
> +
> + if (!pm_runtime_get_if_in_use(&client->dev))
> + return 0;
[Severity: High]
Can this lead to an unbalanced decrement of the runtime PM usage counter?
When pm_runtime_get_if_in_use() is called while the device's runtime PM is
disabled, it returns -EINVAL. Because -EINVAL is non-zero, the check here
evaluates to false and the function proceeds to the switch statement.
This causes the function to unconditionally call pm_runtime_put_autosuspend()
at the end, decrementing the usage counter and potentially causing an
underflow. Would it be safer to explicitly check for positive values, such as
if (pm_runtime_get_if_in_use(&client->dev) <= 0)?
> +
> + switch (ctrl->id) {
[ ... ]
> + }
> +
> + pm_runtime_put_autosuspend(&client->dev);
> +
> + return ret;
> +}
[ ... ]
> +static int mira220_set_framefmt(struct mira220 *mira220,
> + struct v4l2_subdev_state *state)
> +{
[ ... ]
> + /*
> + * Program the ROI area, centered in the sensor's pixel array.
> + *
> + * TODO: Use the crop rectangle sizes once the driver is ported to the
> + * new RAW camera sensor model.
> + */
> + top = (MIRA220_PIXEL_ARRAY_HEIGHT - format->height) / 2;
> + left = (MIRA220_PIXEL_ARRAY_WIDTH - format->width) / 2;
> +
> + cci_write(mira220->regmap, MIRA220_VSTART_REG, top, &ret);
[Severity: Medium]
Is this dynamic windowing logic currently unreachable?
The patch description mentions that the driver dynamically programs frame
windowing. However, looking at mira220_update_pad_format(), the format width
and height are hardcoded to MIRA220_PIXEL_ARRAY_WIDTH and
MIRA220_PIXEL_ARRAY_HEIGHT.
Since mira220_pad_ops below doesn't implement a .set_selection callback,
userspace cannot configure the crop rectangle. Does this mean the top and
left offsets calculated here will always evaluate to zero, making this
calculation dead code for now?
> + cci_write(mira220->regmap, MIRA220_HSTART_REG,
> + left & MIRA220_HSTART_MASK, &ret);
[ ... ]
> +static const struct v4l2_subdev_pad_ops mira220_pad_ops = {
> + .enum_mbus_code = mira220_enum_mbus_code,
> + .get_fmt = v4l2_subdev_get_fmt,
> + .set_fmt = mira220_set_pad_format,
> + .get_selection = mira220_get_selection,
> + .enum_frame_size = mira220_enum_frame_size,
> + .enable_streams = mira220_enable_streams,
> + .disable_streams = mira220_disable_streams,
> +};
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260731-mira220-v11-0-1295fe17021d@ideasonb…