Devicetree
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Vishnu Reddy" <busanna.reddy@oss.qualcomm.com>
Cc: robh@kernel.org, devicetree@vger.kernel.org, conor+dt@kernel.org,
	krzk+dt@kernel.org
Subject: Re: [PATCH v5 06/14] media: iris: Add context bank hooks for platform specific initialization
Date: Sat, 09 May 2026 00:41:08 +0000	[thread overview]
Message-ID: <20260509004109.42A59C2BCB0@smtp.kernel.org> (raw)
In-Reply-To: <20260509-glymur-v5-6-7fbb340c5dbd@oss.qualcomm.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] Teardown order violation in `iris_remove()` creates a race condition with userspace, potentially leading to Use-After-Free or IOMMU faults.
--

commit 4def10f3c3b40c622d9f01893a1225d37915f0d3
Author: Vishnu Reddy <busanna.reddy@oss.qualcomm.com>

media: iris: Add context bank hooks for platform specific initialization

This commit adds initialization and deinitialization hooks in the platform
data for context bank setup. These hooks allow platform-specific code to
configure dedicated firmware context bank devices mapped to the firmware
stream ID.

> diff --git a/drivers/media/platform/qcom/iris/iris_probe.c b/drivers/media/platform/qcom/iris/iris_probe.c
> --- a/drivers/media/platform/qcom/iris/iris_probe.c
> +++ b/drivers/media/platform/qcom/iris/iris_probe.c
[ ... ]
> @@ -193,6 +207,7 @@ static void iris_remove(struct platform_device *pdev)
>  		return;
>  
>  	iris_core_deinit(core);
> +	iris_deinit_cb_devs(core);
>  
>  	video_unregister_device(core->vdev_dec);
>  	video_unregister_device(core->vdev_enc);

Could this teardown order create a race condition with userspace?

The patch calls iris_deinit_cb_devs() before video_unregister_device(),
which leaves a window where the hardware context banks are destroyed while
the v4l2 character devices remain registered and accessible to userspace.

If userspace calls open() on the device during this window, the standard
v4l2_open() will succeed and could eventually call into iris_core_init().
Since iris_core_init() acquires the core lock, detects the deinit state,
and calls iris_fw_load(), it could attempt to load the firmware while the
context banks are being torn down.

Attempting to use destroyed context banks for DMA or firmware mapping could
result in IOMMU faults or memory corruption.

While the pre-existing code already called iris_core_deinit() before
unregistering the video devices, this patch introduces a new failure mode
by explicitly tearing down the context banks during this exposed window.

Should iris_deinit_cb_devs() be called after the video devices are fully
unregistered, similar to the LIFO teardown order followed in the
iris_probe() error paths?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260509-glymur-v5-0-7fbb340c5dbd@oss.qualcomm.com?part=6

  reply	other threads:[~2026-05-09  0:41 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-08 18:59 [PATCH v5 00/14] media: iris: Add support for glymur platform Vishnu Reddy
2026-05-08 18:59 ` [PATCH v5 01/14] media: iris: Add iris vpu bus support Vishnu Reddy
2026-05-08 19:16   ` Dmitry Baryshkov
2026-05-09 17:05     ` Vishnu Reddy
2026-05-08 23:20   ` sashiko-bot
2026-05-08 18:59 ` [PATCH v5 02/14] iommu: Add iris-vpu-bus to iommu_buses Vishnu Reddy
2026-05-08 19:16   ` Dmitry Baryshkov
2026-05-08 23:42   ` sashiko-bot
2026-05-08 18:59 ` [PATCH v5 03/14] media: iris: Fix VM count passed to firmware Vishnu Reddy
2026-05-08 19:20   ` Dmitry Baryshkov
2026-05-08 18:59 ` [PATCH v5 04/14] dt-bindings: media: qcom,venus: Remove clock, power-domain, and iommus from common schema Vishnu Reddy
2026-05-08 19:22   ` Dmitry Baryshkov
2026-05-09 17:04     ` Vishnu Reddy
2026-05-08 18:59 ` [PATCH v5 05/14] dt-bindings: media: qcom,glymur-iris: Add glymur video codec Vishnu Reddy
2026-05-08 18:59 ` [PATCH v5 06/14] media: iris: Add context bank hooks for platform specific initialization Vishnu Reddy
2026-05-09  0:41   ` sashiko-bot [this message]
2026-05-08 18:59 ` [PATCH v5 07/14] media: iris: Enable Secure PAS support with IOMMU managed by Linux Vishnu Reddy
2026-05-08 19:05   ` Trilok Soni
2026-05-08 20:20   ` Dmitry Baryshkov
2026-05-09  2:05   ` sashiko-bot
2026-05-08 18:59 ` [PATCH v5 08/14] media: iris: Rename clock and power domain macros to use vcodec prefix Vishnu Reddy
2026-05-08 20:22   ` Dmitry Baryshkov
2026-05-09 17:07     ` Vishnu Reddy
2026-05-09  2:18   ` sashiko-bot
2026-05-08 18:59 ` [PATCH v5 09/14] media: iris: Use power domain type to look up pd_devs index Vishnu Reddy
2026-05-08 20:44   ` Dmitry Baryshkov
2026-05-09 17:02     ` Vishnu Reddy
2026-05-08 18:59 ` [PATCH v5 10/14] media: iris: Add power sequence for Glymur Vishnu Reddy
2026-05-08 20:54   ` Dmitry Baryshkov
2026-05-09  2:56   ` sashiko-bot
2026-05-08 19:00 ` [PATCH v5 11/14] media: iris: Add support to select core for dual core platforms Vishnu Reddy
2026-05-08 21:00   ` Dmitry Baryshkov
2026-05-09  3:55   ` sashiko-bot
2026-05-08 19:00 ` [PATCH v5 12/14] media: iris: Add platform data for glymur Vishnu Reddy
2026-05-08 21:05   ` Dmitry Baryshkov
2026-05-09  4:23   ` sashiko-bot
2026-05-08 19:00 ` [PATCH v5 13/14] arm64: dts: qcom: glymur: Add iris video node Vishnu Reddy
2026-05-08 19:27   ` Dmitry Baryshkov
2026-05-09 16:56     ` Vishnu Reddy
2026-05-08 19:00 ` [PATCH v5 14/14] arm64: dts: qcom: glymur-crd: Enable iris video codec node Vishnu Reddy
2026-05-08 23:54   ` 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=20260509004109.42A59C2BCB0@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=krzk+dt@kernel.org \
    --cc=robh@kernel.org \
    --cc=sashiko@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