Linux-mediatek Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Nicolas Dufresne <nicolas.dufresne@collabora.com>
To: Icenowy Zheng <zhengxingda@iscas.ac.cn>,
	Bin Liu <bin.liu@mediatek.com>,
	Mauro Carvalho Chehab	 <mchehab@kernel.org>,
	Matthias Brugger <matthias.bgg@gmail.com>,
	 AngeloGioacchino Del Regno
	<angelogioacchino.delregno@collabora.com>,
	Fan Wu <fanwu01@zju.edu.cn>,
	Hans Verkuil	 <hverkuil+cisco@kernel.org>,
	irui wang <irui.wang@mediatek.com>,
	kyrie wu	 <kyrie.wu@mediatek.com>
Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org,
	 linux-arm-kernel@lists.infradead.org,
	linux-mediatek@lists.infradead.org,  stable@vger.kernel.org
Subject: Re: [PATCH] media: mtk-jpeg: only init/cancel work for multi-core variants
Date: Wed, 15 Jul 2026 20:10:47 -0400	[thread overview]
Message-ID: <c0aa1f673f13704e05fd564904c5cf28a2dba9e6.camel@collabora.com> (raw)
In-Reply-To: <20260601073218.1281840-1-zhengxingda@iscas.ac.cn>

[-- Attachment #1: Type: text/plain, Size: 2034 bytes --]

Hi,

Le lundi 01 juin 2026 à 15:32 +0800, Icenowy Zheng a écrit :
> Single-core variants of this hardware do not use the work at all, and
> the worker function is set to NULL, which leads to warnings when
> cancelling the work in release callback.
> 
> Skip the work init/cancel code when the JPEG hardware isn't multi-core.

Thanks for sending this patch, thought this specific issue has alrady been fixed
upstream, see commit b1845a227fda37b2fe5327df3ca0015d7e290235

Nicolas

> 
> Cc: stable@vger.kernel.org
> Fixes: 34c519feef3e ("media: mtk-jpeg: fix use-after-free in release path due
> to uncancelled work")
> Fixes: d40e95274925 ("media: mtk-jpeg: reconstructs the initialization mode of
> worker")
> Signed-off-by: Icenowy Zheng <zhengxingda@iscas.ac.cn>
> ---
>  drivers/media/platform/mediatek/jpeg/mtk_jpeg_core.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/media/platform/mediatek/jpeg/mtk_jpeg_core.c
> b/drivers/media/platform/mediatek/jpeg/mtk_jpeg_core.c
> index 8c684756d5fc2..83e54a7ef49c0 100644
> --- a/drivers/media/platform/mediatek/jpeg/mtk_jpeg_core.c
> +++ b/drivers/media/platform/mediatek/jpeg/mtk_jpeg_core.c
> @@ -1160,7 +1160,8 @@ static int mtk_jpeg_open(struct file *file)
>  		goto free;
>  	}
>  
> -	INIT_WORK(&ctx->jpeg_work, jpeg->variant->jpeg_worker);
> +	if (jpeg->variant->multi_core)
> +		INIT_WORK(&ctx->jpeg_work, jpeg->variant->jpeg_worker);
>  	INIT_LIST_HEAD(&ctx->dst_done_queue);
>  	spin_lock_init(&ctx->done_queue_lock);
>  	v4l2_fh_init(&ctx->fh, vfd);
> @@ -1202,7 +1203,8 @@ static int mtk_jpeg_release(struct file *file)
>  	struct mtk_jpeg_dev *jpeg = video_drvdata(file);
>  	struct mtk_jpeg_ctx *ctx = mtk_jpeg_file_to_ctx(file);
>  
> -	cancel_work_sync(&ctx->jpeg_work);
> +	if (jpeg->variant->multi_core)
> +		cancel_work_sync(&ctx->jpeg_work);
>  	mutex_lock(&jpeg->lock);
>  	v4l2_m2m_ctx_release(ctx->fh.m2m_ctx);
>  	v4l2_ctrl_handler_free(&ctx->ctrl_hdl);

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

      reply	other threads:[~2026-07-16  0:11 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-01  7:32 [PATCH] media: mtk-jpeg: only init/cancel work for multi-core variants Icenowy Zheng
2026-07-16  0:10 ` Nicolas Dufresne [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=c0aa1f673f13704e05fd564904c5cf28a2dba9e6.camel@collabora.com \
    --to=nicolas.dufresne@collabora.com \
    --cc=angelogioacchino.delregno@collabora.com \
    --cc=bin.liu@mediatek.com \
    --cc=fanwu01@zju.edu.cn \
    --cc=hverkuil+cisco@kernel.org \
    --cc=irui.wang@mediatek.com \
    --cc=kyrie.wu@mediatek.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=matthias.bgg@gmail.com \
    --cc=mchehab@kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=zhengxingda@iscas.ac.cn \
    /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