From: Nicolas Dufresne <nicolas@ndufresne.ca>
To: Wentao Liang <vulab@iscas.ac.cn>,
angelogioacchino.delregno@collabora.com
Cc: bin.liu@mediatek.com, hverkuil@kernel.org,
irui.wang@mediatek.com, kyrie.wu@mediatek.com,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, linux-media@vger.kernel.org,
linux-mediatek@lists.infradead.org, matthias.bgg@gmail.com,
mchehab@kernel.org, stable@vger.kernel.org
Subject: Re: [PATCH] media: mtk-jpeg: Fix runtime PM leak in mtk_jpegdec_worker()
Date: Tue, 29 Sep 2026 17:00:54 -0400 [thread overview]
Message-ID: <2e3c6c4eb72d79ef8b995d6ae62a6424685ec281.camel@ndufresne.ca> (raw)
In-Reply-To: <20260917100247.2145872-1-vulab@iscas.ac.cn>
[-- Attachment #1: Type: text/plain, Size: 1524 bytes --]
Le jeudi 17 septembre 2026 à 10:02 +0000, Wentao Liang a écrit :
> pm_runtime_get_sync() leaves the device's runtime PM usage count
> incremented even when it fails. mtk_jpegdec_worker() jumps to
> dec_end on that failure, which does not call pm_runtime_put(), so
> the reference taken by the failed resume is leaked.
>
> Use pm_runtime_resume_and_get() instead, which drops the reference
> again when resuming the device fails.
>
> Fixes: dedc21500334 ("media: mtk-jpegdec: add jpeg decode worker interface")
> Cc: stable@vger.kernel.org
> Signed-off-by: Wentao Liang <vulab@iscas.ac.cn>
Reviewed-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
> ---
> drivers/media/platform/mediatek/jpeg/mtk_jpeg_core.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/media/platform/mediatek/jpeg/mtk_jpeg_core.c b/drivers/media/platform/mediatek/jpeg/mtk_jpeg_core.c
> index 8c684756d5fc..ed1d5858c942 100644
> --- a/drivers/media/platform/mediatek/jpeg/mtk_jpeg_core.c
> +++ b/drivers/media/platform/mediatek/jpeg/mtk_jpeg_core.c
> @@ -1732,7 +1732,7 @@ static void mtk_jpegdec_worker(struct work_struct *work)
> jpeg_dst_buf->frame_num = ctx->total_frame_num;
>
> mtk_jpegdec_set_hw_param(ctx, hw_id, src_buf, dst_buf);
> - ret = pm_runtime_get_sync(comp_jpeg[hw_id]->dev);
> + ret = pm_runtime_resume_and_get(comp_jpeg[hw_id]->dev);
> if (ret < 0) {
> dev_err(jpeg->dev, "%s : %d, pm_runtime_get_sync fail !!!\n",
> __func__, __LINE__);
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
next prev parent reply other threads:[~2026-09-29 21:01 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-17 10:02 [PATCH] media: mtk-jpeg: Fix runtime PM leak in mtk_jpegdec_worker() Wentao Liang
2026-09-29 21:00 ` Nicolas Dufresne [this message]
2026-09-29 21:01 ` Nicolas Dufresne
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=2e3c6c4eb72d79ef8b995d6ae62a6424685ec281.camel@ndufresne.ca \
--to=nicolas@ndufresne.ca \
--cc=angelogioacchino.delregno@collabora.com \
--cc=bin.liu@mediatek.com \
--cc=hverkuil@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=vulab@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