All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Vishnu Reddy" <busanna.reddy@oss.qualcomm.com>
Cc: devicetree@vger.kernel.org, conor+dt@kernel.org, robh@kernel.org
Subject: Re: [PATCH v9 07/14] media: iris: Replace enum-indexed clock and power domain tables with per-block structures
Date: Wed, 15 Jul 2026 14:39:23 +0000	[thread overview]
Message-ID: <20260715143923.84BF01F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260715-glymur-v9-7-8cf2cbe12a07@oss.qualcomm.com>

Thank you for your contribution! Sashiko AI review found 4 potential issue(s) to consider:

New issues:
- [High] Bundling global device OPP rate adjustments into per-block helpers drops the global OPP rate to 0 on error paths, potentially crashing active hardware blocks.
- [Medium] Multi-core platforms will fail to power on/off secondary hardware cores due to implicit array-to-pointer decay.
- [Medium] Unconditional use of optional power domain structures in VPU4x hardware enable/disable paths leads to NULL pointer dereferences.

Pre-existing issues:
- [Critical] The `sys_error_handler` delayed work is not canceled during driver removal, leading to a Use-After-Free of the `core` structure.
--

--- Patch [7]: [PATCH v9 07/14] media: iris: Replace enum-indexed clock and power domain tables with per-block structures ---
Note: The format of this review is altered to provide a free-form summary
of the findings due to restrictions on quoting the original patch text.

Commit: 67736d0c8e0f502135f0c4a867f560515cee6311
Author: Vishnu Reddy <busanna.reddy@oss.qualcomm.com>
Subject: media: iris: Replace enum-indexed clock and power domain tables...

This patch refactors the Iris driver to replace flat, enum-indexed arrays
with per-block data structures bundling power domains and clocks together.
It aims to simplify platform extension by operating directly on the block
instances during enable and disable paths.

[Severity: Medium]
In drivers/media/platform/qcom/iris/iris_vpu_common.c inside
iris_vpu_power_on_hw(), and in iris_vpu4x.c inside
iris_vpu4x_power_on_hardware(), the code passes the core->vcodec pointer
directly to iris_enable_power_domain_and_clocks(). Since core->vcodec is
allocated as an array based on plat->num_cores during initialization, does
passing it directly cause it to decay to a pointer to the first element?
If so, wouldn't this leave secondary hardware cores unpowered on multi-core
platforms?

[Severity: High]
Looking at iris_enable_power_domain_and_clocks() in iris_resources.c, the
error path calls iris_opp_set_rate(core->dev, 0). Because core->dev manages
the global OPP state for the entire Iris core, dropping the rate to 0 here
affects all blocks. If enabling a secondary domain like vcodec_vpp0 fails,
could this starve the already-enabled primary vcodec block of voltage while
its clocks are still running, potentially hanging or crashing the hardware?

[Severity: Medium]
In iris_vpu4x_power_on_hardware() in iris_vpu4x.c, the code checks the
hardware efuse to decide whether to enable vcodec_vpp0. It then passes
core->vcodec_vpp0 to the enable helper. If a platform omits the optional
vcodec_vpp0_data but the efuse still indicates it is present, the pointer
will be NULL. Since the helper immediately dereferences pd->pd_cnt without
any NULL checks, does this introduce a NULL pointer dereference?

[Severity: Critical]
This is a pre-existing issue, but looking at iris_remove() in iris_probe.c,
it seems the sys_error_handler delayed work is never canceled before the
driver is torn down. If driver unbind or module unload occurs right after a
fatal system error queues this work, the core structure will be freed by
devres upon returning. Could this result in a use-after-free when the
delayed work subsequently executes?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260715-glymur-v9-0-8cf2cbe12a07@oss.qualcomm.com?part=7

  reply	other threads:[~2026-07-15 14:39 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-15 14:09 [PATCH v9 00/14] media: iris: Add support for glymur platform Vishnu Reddy
2026-07-15 14:09 ` [PATCH v9 01/14] dt-bindings: media: qcom,glymur-iris: Add glymur video codec Vishnu Reddy
2026-07-15 14:22   ` sashiko-bot
2026-07-15 14:09 ` [PATCH v9 02/14] media: iris: Add hooks to initialize and tear down context banks Vishnu Reddy
2026-07-15 14:23   ` sashiko-bot
2026-07-15 14:09 ` [PATCH v9 03/14] media: iris: Add helper to create a context bank device Vishnu Reddy
2026-07-15 14:09 ` [PATCH v9 04/14] media: iris: Add helper to select relevant " Vishnu Reddy
2026-07-15 14:29   ` sashiko-bot
2026-07-15 14:09 ` [PATCH v9 05/14] media: iris: Skip DMA mask setting to core device when IOMMU is not mapped Vishnu Reddy
2026-07-15 14:22   ` sashiko-bot
2026-07-15 14:10 ` [PATCH v9 06/14] media: iris: Enable Secure PAS support with IOMMU managed by Linux Vishnu Reddy
2026-07-15 14:37   ` sashiko-bot
2026-07-15 14:10 ` [PATCH v9 07/14] media: iris: Replace enum-indexed clock and power domain tables with per-block structures Vishnu Reddy
2026-07-15 14:39   ` sashiko-bot [this message]
2026-07-15 14:10 ` [PATCH v9 08/14] media: iris: Add power sequence for glymur Vishnu Reddy
2026-07-15 14:36   ` sashiko-bot
2026-07-15 14:10 ` [PATCH v9 09/14] media: iris: Handle CPU_CS_SCIACMDARG3 register write via program bootup registers hook Vishnu Reddy
2026-07-15 14:10 ` [PATCH v9 10/14] media: iris: Add support to select core for dual core platforms Vishnu Reddy
2026-07-15 14:42   ` sashiko-bot
2026-07-15 14:10 ` [PATCH v9 11/14] media: iris: Add hooks for pixel and non-pixel context banks Vishnu Reddy
2026-07-15 14:52   ` sashiko-bot
2026-07-15 15:27   ` Bryan O'Donoghue
2026-07-15 14:10 ` [PATCH v9 12/14] media: iris: Add platform data for glymur Vishnu Reddy
2026-07-15 14:10 ` [PATCH v9 13/14] arm64: dts: qcom: glymur: Add iris video node Vishnu Reddy
2026-07-15 15:18   ` sashiko-bot
2026-07-15 14:10 ` [PATCH v9 14/14] arm64: dts: qcom: glymur-crd: Enable iris video codec node Vishnu Reddy

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=20260715143923.84BF01F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=busanna.reddy@oss.qualcomm.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=robh@kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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.