All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Dmitry Baryshkov" <dmitry.baryshkov@oss.qualcomm.com>
Cc: media-ci@linuxtv.org, conor+dt@kernel.org, robh@kernel.org,
	devicetree@vger.kernel.org
Subject: Re: [PATCH v8 17/18] media: venus: skip QCM2290 if Iris driver is enabled
Date: Thu, 30 Jul 2026 15:39:12 +0000	[thread overview]
Message-ID: <20260730153912.BAC5E1F00A3D@smtp.kernel.org> (raw)
In-Reply-To: <20260730-iris-ar50lt-v8-17-6597c08cea6f@oss.qualcomm.com>

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

Pre-existing issues:
- [Critical] Unbalanced teardown of delayed work core->work leads to Use-After-Free.
- [Medium] Memory and DMA allocations are leaked on the venus_probe() error path.
--

--- Patch [17]: [PATCH v8 17/18] media: venus: skip QCM2290 if Iris driver is enabled ---
commit 3f4135bbccd5abb2cbdcfce435629b2b86cda1f5
Author: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>

media: venus: skip QCM2290 if Iris driver is enabled

As the Iris driver now supports the QCM2290 hardware too, there is a
race between Venus and Iris drivers on binding to the corresponding
device. Follow the approach used by other platforms and skip QCM2290 in
the Venus driver if Iris is enabled.

> diff --git a/drivers/media/platform/qcom/venus/core.c b/drivers/media/platform/qcom/venus/core.c
> index 243e342b0ae75..3c88594eb1d00 100644
> --- a/drivers/media/platform/qcom/venus/core.c
> +++ b/drivers/media/platform/qcom/venus/core.c
[ ... ]
> @@ -1169,13 +1168,16 @@ static const struct venus_resources qcm2290_res = {
>  	.enc_nodename = "video-encoder",
>  	.min_fw = &min_fw,
>  };
> +#endif
>  
>  static const struct of_device_id venus_dt_match[] = {
>  	{ .compatible = "qcom,msm8916-venus", .data = &msm8916_res, },
>  	{ .compatible = "qcom,msm8939-venus", .data = &msm8939_res, },
>  	{ .compatible = "qcom,msm8996-venus", .data = &msm8996_res, },
>  	{ .compatible = "qcom,msm8998-venus", .data = &msm8998_res, },
> +#if (!IS_ENABLED(CONFIG_VIDEO_QCOM_IRIS))
>  	{ .compatible = "qcom,qcm2290-venus", .data = &qcm2290_res, },
> +#endif
>  	{ .compatible = "qcom,sc7180-venus", .data = &sc7180_res, },
>  	{ .compatible = "qcom,sdm660-venus", .data = &sdm660_res, },
>  	{ .compatible = "qcom,sdm845-venus", .data = &sdm845_res, },

[Severity: Medium]
This is a pre-existing issue, but does the error path in venus_probe() leak
memory and DMA allocations?

Looking at venus_probe(), if devm_request_threaded_irq() fails, the code jumps
directly to err_core_put:

drivers/media/platform/qcom/venus/core.c:venus_probe() {
    ...
	ret = devm_request_threaded_irq(dev, core->irq, hfi_isr, venus_isr_thread,
					IRQF_TRIGGER_HIGH | IRQF_ONESHOT,
					"venus", core);
	if (ret)
		goto err_core_put;
    ...
err_hfi_destroy:
	hfi_destroy(core);
err_core_put:
    ...
}

This bypasses err_hfi_destroy and skips the hfi_destroy() cleanup, permanently
leaking the resources allocated by hfi_create(). Should the failure path jump
to err_hfi_destroy instead?

[Severity: Critical]
This is a pre-existing issue, but could the delayed work core->work lead to a
use-after-free?

In the venus_probe() error path, cancel_delayed_work_sync() is omitted entirely.
If the IRQ is successfully registered and fires before probe aborts, it can
queue core->work which could execute after the core object is freed.

Additionally, in venus_remove():

drivers/media/platform/qcom/venus/core.c:venus_remove() {
	cancel_delayed_work_sync(&core->work);
    ...
	hfi_destroy(core);
    ...
}

cancel_delayed_work_sync() is invoked before the IRQ is disabled in
hfi_destroy(). If an interrupt fires between these two calls, the ISR can
re-queue the work, which will subsequently execute on a freed core object. 

Could we move the cancel_delayed_work_sync() call after the IRQ is disabled?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260730-iris-ar50lt-v8-0-6597c08cea6f@oss.qualcomm.com?part=17

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

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <J0r-fdDYeS3FyqabzR_0wiwxC-2onZeePkUSfv0NavGV8KB3Anc-j8yKHqfY2I3X4VAiZpRkYSIZLaTwuyhKMA==@protonmail.internalid>
2026-07-30 15:20 ` [PATCH v8 00/18] media: iris: Add AR50LT core support and enable Agatti platform Dmitry Baryshkov
2026-07-30 15:20   ` [PATCH v8 01/18] media: iris: Add Gen2 firmware autodetect and fallback Dmitry Baryshkov
2026-07-30 15:37     ` sashiko-bot
2026-07-30 20:02     ` Bryan O'Donoghue
2026-07-30 15:20   ` [PATCH v8 02/18] media: iris: Skip UBWC configuration when not supported Dmitry Baryshkov
2026-07-30 15:32     ` sashiko-bot
2026-07-30 23:24       ` Dmitry Baryshkov
2026-07-30 15:20   ` [PATCH v8 03/18] media: iris: drop IRIS_FMT_foo enumeration Dmitry Baryshkov
2026-07-30 15:20   ` [PATCH v8 04/18] media: iris: Filter UBWC raw formats based on hardware capabilities Dmitry Baryshkov
2026-07-30 15:20   ` [PATCH v8 05/18] media: iris: Introduce set_preset_register as a vpu_op Dmitry Baryshkov
2026-07-30 15:20   ` [PATCH v8 06/18] media: iris: Introduce interrupt_init " Dmitry Baryshkov
2026-07-30 15:20   ` [PATCH v8 07/18] media: iris: add vpu op hook to disable ARP buffer Dmitry Baryshkov
2026-07-30 15:41     ` sashiko-bot
2026-07-30 15:20   ` [PATCH v8 08/18] media: iris: Add platform data field for watchdog interrupt mask Dmitry Baryshkov
2026-07-30 15:32     ` sashiko-bot
2026-07-30 23:26       ` Dmitry Baryshkov
2026-07-30 15:20   ` [PATCH v8 09/18] media: iris: Add platform flag for instantaneous bandwidth voting Dmitry Baryshkov
2026-07-30 15:20   ` [PATCH v8 10/18] media: iris: skip PIPE if it is not supported by the platform Dmitry Baryshkov
2026-07-30 15:56     ` sashiko-bot
2026-07-30 15:20   ` [PATCH v8 11/18] media: iris: Add framework support for AR50_LITE video core Dmitry Baryshkov
2026-07-30 15:41     ` sashiko-bot
2026-07-30 15:20   ` [PATCH v8 12/18] media: iris: add minimal GET_PROPERTY implementation Dmitry Baryshkov
2026-07-30 15:39     ` sashiko-bot
2026-07-30 15:20   ` [PATCH v8 13/18] media: iris: update buffer requirements based on received info Dmitry Baryshkov
2026-07-30 15:52     ` sashiko-bot
2026-07-30 15:20   ` [PATCH v8 14/18] media: iris: implement support for the Agatti platform Dmitry Baryshkov
2026-07-30 15:54     ` sashiko-bot
2026-07-30 23:37       ` Dmitry Baryshkov
2026-07-30 15:20   ` [PATCH v8 15/18] media: iris: Introduce buffer size calculations for AR50LT Dmitry Baryshkov
2026-07-30 15:47     ` sashiko-bot
2026-07-30 23:40       ` Dmitry Baryshkov
2026-07-30 15:20   ` [PATCH v8 16/18] media: iris: add Gen2 firmware support on the Agatti platform Dmitry Baryshkov
2026-07-30 15:21   ` [PATCH v8 17/18] media: venus: skip QCM2290 if Iris driver is enabled Dmitry Baryshkov
2026-07-30 15:39     ` sashiko-bot [this message]
2026-07-30 15:21   ` [PATCH v8 18/18] media: iris: constify inst_fw_cap_sm8250_dec Dmitry Baryshkov
2026-07-30 20:09   ` [PATCH v8 00/18] media: iris: Add AR50LT core support and enable Agatti platform Bryan O'Donoghue

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=20260730153912.BAC5E1F00A3D@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=media-ci@linuxtv.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.