* [PATCH] media: mediatek: vcodec: destroy core workqueue on remove
@ 2026-09-15 11:57 Guangshuo Li
2026-09-29 21:11 ` Nicolas Dufresne
0 siblings, 1 reply; 2+ messages in thread
From: Guangshuo Li @ 2026-09-15 11:57 UTC (permalink / raw)
To: Tiffany Lin, Andrew-CT Chen, Yunfei Dong, Mauro Carvalho Chehab,
Matthias Brugger, AngeloGioacchino Del Regno, Nicolas Dufresne,
Fei Shao, Kees Cook, Guangshuo Li, Chen-Yu Tsai, Hans Verkuil,
Steve Cho, linux-media, linux-kernel, linux-arm-kernel,
linux-mediatek
Cc: stable
The decoder probe allocates core_workqueue for latency-based decoder
architectures. The probe failure paths destroy the workqueue, but the
normal remove path only destroys decode_workqueue.
As a result, removing a latency-based decoder leaves core_workqueue
allocated after the device lifetime has ended.
Destroy core_workqueue during remove for latency-based decoder
architectures, matching the cleanup performed by the probe failure
paths.
This issue was found by manual code inspection.
Fixes: 365e4ba01df4 ("media: mtk-vcodec: Add work queue for core hardware decode")
Cc: stable@vger.kernel.org
Signed-off-by: Guangshuo Li <lgs201920130244@gmail.com>
---
.../media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_drv.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_drv.c b/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_drv.c
index e936ed8dffba..426d060d937c 100644
--- a/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_drv.c
+++ b/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_drv.c
@@ -570,6 +570,8 @@ static void mtk_vcodec_dec_remove(struct platform_device *pdev)
struct mtk_vcodec_dec_dev *dev = platform_get_drvdata(pdev);
destroy_workqueue(dev->decode_workqueue);
+ if (IS_VDEC_LAT_ARCH(dev->vdec_pdata->hw_arch))
+ destroy_workqueue(dev->core_workqueue);
if (media_devnode_is_registered(dev->mdev_dec.devnode)) {
media_device_unregister(&dev->mdev_dec);
--
2.43.0
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] media: mediatek: vcodec: destroy core workqueue on remove
2026-09-15 11:57 [PATCH] media: mediatek: vcodec: destroy core workqueue on remove Guangshuo Li
@ 2026-09-29 21:11 ` Nicolas Dufresne
0 siblings, 0 replies; 2+ messages in thread
From: Nicolas Dufresne @ 2026-09-29 21:11 UTC (permalink / raw)
To: Guangshuo Li, Tiffany Lin, Andrew-CT Chen, Yunfei Dong,
Mauro Carvalho Chehab, Matthias Brugger,
AngeloGioacchino Del Regno, Fei Shao, Kees Cook, Chen-Yu Tsai,
Hans Verkuil, Steve Cho, linux-media, linux-kernel,
linux-arm-kernel, linux-mediatek
Cc: stable
[-- Attachment #1: Type: text/plain, Size: 1944 bytes --]
Le mardi 15 septembre 2026 à 19:57 +0800, Guangshuo Li a écrit :
> The decoder probe allocates core_workqueue for latency-based decoder
> architectures. The probe failure paths destroy the workqueue, but the
> normal remove path only destroys decode_workqueue.
>
> As a result, removing a latency-based decoder leaves core_workqueue
LAT is an abbreviation to for the core responsible for entropy decoding. I don't
know what it translate to, but its not "latency", I'll do the minor edit. It
does reduce decoding latency though :-D
> allocated after the device lifetime has ended.
>
> Destroy core_workqueue during remove for latency-based decoder
> architectures, matching the cleanup performed by the probe failure
> paths.
>
> This issue was found by manual code inspection.
>
> Fixes: 365e4ba01df4 ("media: mtk-vcodec: Add work queue for core hardware decode")
> Cc: stable@vger.kernel.org
> Signed-off-by: Guangshuo Li <lgs201920130244@gmail.com>
Reviewed-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
> ---
> .../media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_drv.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_drv.c b/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_drv.c
> index e936ed8dffba..426d060d937c 100644
> --- a/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_drv.c
> +++ b/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_drv.c
> @@ -570,6 +570,8 @@ static void mtk_vcodec_dec_remove(struct platform_device *pdev)
> struct mtk_vcodec_dec_dev *dev = platform_get_drvdata(pdev);
>
> destroy_workqueue(dev->decode_workqueue);
> + if (IS_VDEC_LAT_ARCH(dev->vdec_pdata->hw_arch))
> + destroy_workqueue(dev->core_workqueue);
>
> if (media_devnode_is_registered(dev->mdev_dec.devnode)) {
> media_device_unregister(&dev->mdev_dec);
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-09-29 21:11 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-15 11:57 [PATCH] media: mediatek: vcodec: destroy core workqueue on remove Guangshuo Li
2026-09-29 21:11 ` Nicolas Dufresne
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®