From: sashiko-bot@kernel.org
To: "Vikash Garodia" <vikash.garodia@oss.qualcomm.com>
Cc: devicetree@vger.kernel.org, robh@kernel.org,
media-ci@linuxtv.org, conor+dt@kernel.org
Subject: Re: [PATCH v2 05/12] media: iris: Route buffers to the matching context bank device
Date: Fri, 31 Jul 2026 18:57:12 +0000 [thread overview]
Message-ID: <20260731185713.04BFF1F00ACA@smtp.kernel.org> (raw)
In-Reply-To: <20260731-vpu_iommu_iova_handling-v2-5-da52b5228dbd@oss.qualcomm.com>
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@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-da52b5228dbd@oss.qualcomm.com?part=5
next prev parent reply other threads:[~2026-07-31 18:57 UTC|newest]
Thread overview: 57+ 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-08-01 10:06 ` Bryan O'Donoghue
2026-08-06 5:21 ` Vikash Garodia
2026-08-06 7:54 ` Bryan O'Donoghue
2026-08-06 7:57 ` Vikash Garodia
2026-08-06 9:40 ` Bryan O'Donoghue
2026-08-06 10:07 ` Bryan O'Donoghue
2026-08-06 10:14 ` Krzysztof Kozlowski
2026-08-06 10:24 ` Bryan O'Donoghue
2026-08-06 10:32 ` Krzysztof Kozlowski
2026-08-06 10:50 ` Bryan O'Donoghue
2026-08-06 11:14 ` Dmitry Baryshkov
2026-08-06 11:19 ` Bryan O'Donoghue
2026-08-06 12:20 ` Vikash Garodia
2026-08-05 7:21 ` Krzysztof Kozlowski
2026-08-05 10:37 ` Krzysztof Kozlowski
2026-08-06 8:46 ` Dmitry Baryshkov
2026-08-06 9:11 ` Krzysztof Kozlowski
2026-08-06 9:20 ` Krzysztof Kozlowski
2026-08-06 9:22 ` Dmitry Baryshkov
2026-08-06 9:36 ` Krzysztof Kozlowski
2026-08-06 10:35 ` Dmitry Baryshkov
2026-08-06 11:56 ` Vikash Garodia
2026-08-06 12:10 ` Dmitry Baryshkov
2026-08-06 8:49 ` Dmitry Baryshkov
2026-08-06 9:52 ` Vikash Garodia
2026-08-06 10:38 ` Dmitry Baryshkov
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-08-06 8:51 ` Dmitry Baryshkov
2026-08-05 7:21 ` Krzysztof Kozlowski
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-08-06 8:53 ` Dmitry Baryshkov
2026-07-31 18:22 ` [PATCH v2 04/12] media: iris: Add helper to create a context bank device Vikash Garodia
2026-08-06 8:57 ` Dmitry Baryshkov
2026-08-06 10:08 ` Vikash Garodia
2026-08-06 10:18 ` Krzysztof Kozlowski
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 [this message]
2026-08-06 9:03 ` Dmitry Baryshkov
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-08-06 9:07 ` Dmitry Baryshkov
2026-08-06 10:06 ` Vikash Garodia
2026-08-06 10:53 ` Dmitry Baryshkov
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
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=20260731185713.04BFF1F00ACA@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 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.