mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Ming Qian(OSS)" <ming.qian@oss.nxp.com>
To: Myeonghun Pak <mhun512@gmail.com>, Ming Qian <ming.qian@nxp.com>,
	Zhou Peng <eagle.zhou@nxp.com>,
	Mauro Carvalho Chehab <mchehab@kernel.org>
Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org,
	stable@vger.kernel.org, Ijae Kim <ae878000@gmail.com>
Subject: Re: [PATCH v4 2/2] media: amphion: prevent unbind while video instances are open
Date: Tue, 29 Sep 2026 09:43:17 +0800	[thread overview]
Message-ID: <11eb0652-9d90-42e5-a7a1-d1e0c7535896@oss.nxp.com> (raw)
In-Reply-To: <20260925191706.3144437-3-mhun512@gmail.com>



On 9/26/2026 3:17 AM, Myeonghun Pak wrote:
> An open video instance holds a plain pointer to its devm-allocated core.
> Unbinding the core or its parent through sysfs can release that memory
> while the instance remains open. A later ioctl or close then uses the
> stale pointer.
> 
> The video file operations pin the module, but sysfs unbind bypasses that
> protection. Suppress manual bind and unbind for both platform drivers,
> and warn if core removal ever encounters a live instance.
> 
> Fixes: 9f599f351e86 ("media: amphion: add vpu core driver")
> Cc: stable@vger.kernel.org
> Co-developed-by: Ijae Kim <ae878000@gmail.com>
> Signed-off-by: Ijae Kim <ae878000@gmail.com>
> Signed-off-by: Myeonghun Pak <mhun512@gmail.com>

Reviewed-by: Ming Qian <ming.qian@oss.nxp.com>

> ---
>   drivers/media/platform/amphion/vpu_core.c | 3 +++
>   drivers/media/platform/amphion/vpu_drv.c  | 1 +
>   2 files changed, 4 insertions(+)
> 
> diff --git a/drivers/media/platform/amphion/vpu_core.c b/drivers/media/platform/amphion/vpu_core.c
> index a0c58ec97a42..2e8e08e05de7 100644
> --- a/drivers/media/platform/amphion/vpu_core.c
> +++ b/drivers/media/platform/amphion/vpu_core.c
> @@ -696,6 +696,8 @@ static void vpu_core_remove(struct platform_device *pdev)
>   	struct vpu_core *core = platform_get_drvdata(pdev);
>   	int ret;
>   
> +	WARN_ON(!list_empty(&core->instances));
> +
>   	vpu_core_remove_dbgfs_file(core);
>   	ret = pm_runtime_resume_and_get(dev);
>   	WARN_ON(ret < 0);
> @@ -846,6 +848,7 @@ static struct platform_driver amphion_vpu_core_driver = {
>   	.remove = vpu_core_remove,
>   	.driver = {
>   		.name = "amphion-vpu-core",
> +		.suppress_bind_attrs = true,
>   		.of_match_table = vpu_core_dt_match,
>   		.pm = &vpu_core_pm_ops,
>   	},
> diff --git a/drivers/media/platform/amphion/vpu_drv.c b/drivers/media/platform/amphion/vpu_drv.c
> index 2cca61f41bea..9c6f32c5eae9 100644
> --- a/drivers/media/platform/amphion/vpu_drv.c
> +++ b/drivers/media/platform/amphion/vpu_drv.c
> @@ -205,6 +205,7 @@ static struct platform_driver amphion_vpu_driver = {
>   	.remove = vpu_remove,
>   	.driver = {
>   		.name = "amphion-vpu",
> +		.suppress_bind_attrs = true,
>   		.of_match_table = vpu_dt_match,
>   	},
>   };


      reply	other threads:[~2026-09-29  1:43 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-25 19:17 [PATCH v4 0/2] media: amphion: fix VPU core lifetime during teardown Myeonghun Pak
2026-09-25 19:17 ` [PATCH v4 1/2] media: amphion: drain message work before releasing core state Myeonghun Pak
2026-09-29  1:42   ` Ming Qian(OSS)
2026-09-25 19:17 ` [PATCH v4 2/2] media: amphion: prevent unbind while video instances are open Myeonghun Pak
2026-09-29  1:43   ` Ming Qian(OSS) [this message]

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=11eb0652-9d90-42e5-a7a1-d1e0c7535896@oss.nxp.com \
    --to=ming.qian@oss.nxp.com \
    --cc=ae878000@gmail.com \
    --cc=eagle.zhou@nxp.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=mhun512@gmail.com \
    --cc=ming.qian@nxp.com \
    --cc=stable@vger.kernel.org \
    /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

all inboxes | Powered by JetHome®