Devicetree
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Dmitry Baryshkov" <dmitry.baryshkov@oss.qualcomm.com>
Cc: robh@kernel.org, devicetree@vger.kernel.org, conor+dt@kernel.org
Subject: Re: [PATCH v7 09/18] media: iris: Add platform flag for instantaneous bandwidth voting
Date: Thu, 09 Jul 2026 13:59:16 +0000	[thread overview]
Message-ID: <20260709135916.99FF41F00A3D@smtp.kernel.org> (raw)
In-Reply-To: <20260709-iris-ar50lt-v7-9-76af9dd4d1f6@oss.qualcomm.com>

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

Pre-existing issues:
- [Critical] This problem wasn't introduced by this patch, but the `iris_core` structure is allocated with `devm_kzalloc`, leading to a Use-After-Free during device unbind because the video device and delayed work outlive the device-managed allocation.
--

--- Patch [9]: [PATCH v7 09/18] media: iris: Add platform flag for instantaneous bandwidth voting ---
commit 5567f5c1da418821cf2cb0c55e4585a7cba76a62
Author: Dikshita Agarwal <dikshita.agarwal@oss.qualcomm.com>

media: iris: Add platform flag for instantaneous bandwidth voting

This commit introduces a platform-configurable instantaneous bandwidth (IB)
multiplier and enables IB voting for all SoCs. It prepares for AR50LT core
support, which requires explicit IB voting in addition to average bandwidth
(AB) for interconnect QoS. Existing platforms will default to an equal IB
and AB, whereas AR50LT will require 2x peak bandwidth.

> diff --git a/drivers/media/platform/qcom/iris/iris_resources.c b/drivers/media/platform/qcom/iris/iris_resources.c
> index 773f6548370a2..caeaf199cef74 100644
> --- a/drivers/media/platform/qcom/iris/iris_resources.c
> +++ b/drivers/media/platform/qcom/iris/iris_resources.c
> @@ -18,6 +18,7 @@
>  
>  int iris_set_icc_bw(struct iris_core *core, unsigned long icc_bw)
>  {
> +	u32 icc_ib_multiplier = core->iris_platform_data->icc_ib_multiplier;
>  	unsigned long bw_kbps = 0, bw_prev = 0;
>  	const struct icc_info *icc_tbl;
>  	int ret = 0, i;

[Severity: Critical]
This is a pre-existing issue, but the iris_core structure is allocated with
devm_kzalloc, which can lead to a use-after-free regression during device
unbind. The video device and delayed work appear to outlive the
device-managed allocation.

In drivers/media/platform/qcom/iris/iris_probe.c:iris_probe():

    core = devm_kzalloc(&pdev->dev, sizeof(*core), GFP_KERNEL);

The unbind path fails to explicitly cancel the delayed work and exits,
triggering devm to free the core structure while V4L2 file descriptors may
still be open:

drivers/media/platform/qcom/iris/iris_probe.c:iris_remove() {
        struct iris_core *core;
        
        core = platform_get_drvdata(pdev);
        if (!core)
            return;
            
        iris_core_deinit(core);
        
        video_unregister_device(core->vdev_dec);
        video_unregister_device(core->vdev_enc);
        
        v4l2_device_unregister(&core->v4l2_dev);
        
        mutex_destroy(&core->lock);
}

When a lingering file descriptor is eventually closed, iris_close() invokes
iris_remove_session(), which dereferences the freed core structure and its
destroyed lock:

drivers/media/platform/qcom/iris/iris_vidc.c:iris_remove_session() {
    struct iris_core *core = inst->core;
    
    mutex_lock(&core->lock);
    ...
}

Can this corrupt memory if the driver is unbound while the video node is in
use, or while the error handling delayed work is active?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260709-iris-ar50lt-v7-0-76af9dd4d1f6@oss.qualcomm.com?part=9

  reply	other threads:[~2026-07-09 13:59 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-09 13:41 [PATCH v7 00/18] media: iris: Add AR50LT core support and enable Agatti platform Dmitry Baryshkov
2026-07-09 13:41 ` [PATCH v7 01/18] media: iris: Add Gen2 firmware autodetect and fallback Dmitry Baryshkov
2026-07-09 13:58   ` sashiko-bot
2026-07-10  4:23   ` Vishnu Reddy
2026-07-09 13:41 ` [PATCH v7 02/18] media: iris: Skip UBWC configuration when not supported Dmitry Baryshkov
2026-07-09 13:41 ` [PATCH v7 03/18] media: iris: drop IRIS_FMT_foo enumeration Dmitry Baryshkov
2026-07-09 13:41 ` [PATCH v7 04/18] media: iris: Filter UBWC raw formats based on hardware capabilities Dmitry Baryshkov
2026-07-09 13:41 ` [PATCH v7 05/18] media: iris: Introduce set_preset_register as a vpu_op Dmitry Baryshkov
2026-07-09 13:41 ` [PATCH v7 06/18] media: iris: Introduce interrupt_init " Dmitry Baryshkov
2026-07-09 13:41 ` [PATCH v7 07/18] media: iris: add vpu op hook to disable ARP buffer Dmitry Baryshkov
2026-07-09 13:41 ` [PATCH v7 08/18] media: iris: Add platform data field for watchdog interrupt mask Dmitry Baryshkov
2026-07-09 13:42 ` [PATCH v7 09/18] media: iris: Add platform flag for instantaneous bandwidth voting Dmitry Baryshkov
2026-07-09 13:59   ` sashiko-bot [this message]
2026-07-09 13:42 ` [PATCH v7 10/18] media: iris: skip PIPE if it is not supported by the platform Dmitry Baryshkov
2026-07-09 14:14   ` sashiko-bot
2026-07-09 13:42 ` [PATCH v7 11/18] media: iris: Add framework support for AR50_LITE video core Dmitry Baryshkov
2026-07-09 13:59   ` sashiko-bot
2026-07-10 10:25   ` Vikash Garodia
2026-07-09 13:42 ` [PATCH v7 12/18] media: iris: add minimal GET_PROPERTY implementation Dmitry Baryshkov
2026-07-09 14:06   ` sashiko-bot
2026-07-09 13:42 ` [PATCH v7 13/18] media: iris: update buffer requirements based on received info Dmitry Baryshkov
2026-07-09 14:05   ` sashiko-bot
2026-07-09 13:42 ` [PATCH v7 14/18] media: iris: implement support for the Agatti platform Dmitry Baryshkov
2026-07-09 14:19   ` sashiko-bot
2026-07-09 13:42 ` [PATCH v7 15/18] media: iris: Introduce buffer size calculations for AR50LT Dmitry Baryshkov
2026-07-09 14:09   ` sashiko-bot
2026-07-09 13:42 ` [PATCH v7 16/18] media: iris: add Gen2 firmware support on the Agatti platform Dmitry Baryshkov
2026-07-09 14:25   ` sashiko-bot
2026-07-09 13:42 ` [PATCH v7 17/18] media: venus: skip QCM2290 if Iris driver is enabled Dmitry Baryshkov
2026-07-09 13:42 ` [PATCH v7 18/18] media: iris: constify inst_fw_cap_sm8250_dec Dmitry Baryshkov

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=20260709135916.99FF41F00A3D@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=dmitry.baryshkov@oss.qualcomm.com \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox