From: sashiko-bot@kernel.org
To: "Vikash Garodia" <vikash.garodia@oss.qualcomm.com>
Cc: conor+dt@kernel.org, media-ci@linuxtv.org, robh@kernel.org,
devicetree@vger.kernel.org
Subject: Re: [PATCH v3 05/13] media: iris: Add non-pixel and pixel context bank devices
Date: Wed, 09 Sep 2026 15:16:06 +0000 [thread overview]
Message-ID: <20260909151606.E06DF1F00A3A@smtp.kernel.org> (raw)
In-Reply-To: <20260909-vpu_iommu_iova_handling-v3-5-2fe43ae45495@oss.qualcomm.com>
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
Pre-existing issues:
- [High] Use-After-Free of devres-allocated `core` memory on driver unbind via lingering file descriptors.
- [High] Missing `cancel_delayed_work_sync` in driver teardown allows `sys_error_handler` to execute asynchronously on freed memory.
--
commit 5f2788e633116dd856570ea29baabf6ce4157fbe
Author: Vikash Garodia <vikash.garodia@oss.qualcomm.com>
media: iris: Add non-pixel and pixel context bank devices
The VPU issues DMA through several SMMU streams, and the hardware does
not give every stream the same addressable range. This patch describes
"non-pixel" and "pixel" as separate context bank subnodes. Helper
functions are added to create and clean up these devices during probe
and remove.
> diff --git a/drivers/media/platform/qcom/iris/iris_probe.c b/drivers/media/platform/qcom/iris/iris_probe.c
> index e4acf4a74f944..debd1f0e57038 100644
> --- a/drivers/media/platform/qcom/iris/iris_probe.c
> +++ b/drivers/media/platform/qcom/iris/iris_probe.c
[ ... ]
> @@ -207,6 +268,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 isn't a bug introduced by this patch, but doesn't this leave the
driver vulnerable to a use-after-free if a userspace process has the
video device open during driver unbind?
The core context is allocated with devm_kzalloc() in iris_probe(),
so it will be freed automatically upon return from iris_remove().
However, this function does not wait for active V4L2 file descriptors
to close. If a lingering file descriptor is closed later, iris_close()
will invoke iris_remove_session(), which accesses the freed core
memory and attempts to lock the destroyed mutex:
iris_vidc.c:iris_remove_session() {
...
mutex_lock(&core->lock);
...
}
[Severity: High]
This is a pre-existing issue, but is there a missing
cancel_delayed_work_sync() for core->sys_error_handler during teardown?
In iris_probe(), the delayed work is initialized:
INIT_DELAYED_WORK(&core->sys_error_handler, iris_sys_error_handler);
If a hardware SYS_ERROR interrupt fires near the time of unbind, the
delayed work could be scheduled. Since iris_remove() completes without
cancelling it, the core memory is freed by devres.
The work queue could subsequently execute iris_sys_error_handler()
asynchronously on the freed pointer, attempting to access core->dev
and call iris_core_deinit(core).
> }
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260909-vpu_iommu_iova_handling-v3-0-2fe43ae45495@oss.qualcomm.com?part=5
next prev parent reply other threads:[~2026-09-09 15:16 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-09 14:57 [PATCH v3 00/13] media: iris: Migrate iommus to iris sub nodes Vikash Garodia
2026-09-09 14:57 ` [PATCH v3 01/13] dt-bindings: media: qcom,venus: Add context bank subnodes to common schema Vikash Garodia
2026-09-10 6:59 ` Krzysztof Kozlowski
2026-09-11 17:43 ` Vikash Garodia
2026-09-09 14:57 ` [PATCH v3 02/13] dt-bindings: media: qcom,sm8550-iris: Add context bank subnodes Vikash Garodia
2026-09-09 15:09 ` sashiko-bot
2026-09-09 20:57 ` Dmitry Baryshkov
2026-09-10 7:00 ` Krzysztof Kozlowski
2026-09-11 17:46 ` Vikash Garodia
2026-09-09 14:57 ` [PATCH v3 03/13] dt-bindings: media: qcom,sm8750-iris: " Vikash Garodia
2026-09-09 21:32 ` Dmitry Baryshkov
2026-09-09 14:57 ` [PATCH v3 04/13] iommu: of_iommu: Add support for "iommu-ranges" on a device node Vikash Garodia
2026-09-09 15:12 ` sashiko-bot
2026-09-09 14:57 ` [PATCH v3 05/13] media: iris: Add non-pixel and pixel context bank devices Vikash Garodia
2026-09-09 15:16 ` sashiko-bot [this message]
2026-09-09 14:57 ` [PATCH v3 06/13] media: iris: Route buffers to the matching context bank device Vikash Garodia
2026-09-09 15:13 ` sashiko-bot
2026-09-09 14:57 ` [PATCH v3 07/13] media: iris: Skip DMA mask setup when the core device has no IOMMU Vikash Garodia
2026-09-09 14:57 ` [PATCH v3 08/13] arm64: dts: qcom: hamoa: Add Iris context bank subnodes Vikash Garodia
2026-09-09 14:57 ` [PATCH v3 09/13] arm64: dts: qcom: sm8550: " Vikash Garodia
2026-09-09 14:57 ` [PATCH v3 10/13] arm64: dts: qcom: lemans: " Vikash Garodia
2026-09-09 15:22 ` sashiko-bot
2026-09-10 7:01 ` Krzysztof Kozlowski
2026-09-09 14:57 ` [PATCH v3 11/13] arm64: dts: qcom: monaco: " Vikash Garodia
2026-09-09 15:21 ` sashiko-bot
2026-09-10 7:03 ` Krzysztof Kozlowski
2026-09-11 17:53 ` Vikash Garodia
2026-09-09 14:57 ` [PATCH v3 12/13] arm64: dts: qcom: sm8650: " Vikash Garodia
2026-09-09 15:26 ` sashiko-bot
2026-09-09 14:57 ` [PATCH v3 13/13] arm64: dts: qcom: sm8750: " Vikash Garodia
2026-09-09 15:24 ` sashiko-bot
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=20260909151606.E06DF1F00A3A@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox