[Deepin-Kernel-SIG] [linux 6.6.y] [FROMLIST] media: mtk-jpeg: only init/cancel work for multi-core variants#1803
Conversation
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.
Cc: stable@vger.kernel.org
Fixes: 34c519feef3e ("media: mtk-jpeg: fix use-after-free in release path due to uncancelled work")
Fixes: d40e952 ("media: mtk-jpeg: reconstructs the initialization mode of worker")
Signed-off-by: Icenowy Zheng <zhengxingda@iscas.ac.cn>
[WangYuli: Fix conflicts]
Link: https://lore.kernel.org/all/20260601073218.1281840-1-zhengxingda@iscas.ac.cn/
Signed-off-by: WangYuli <wangyl5933@chinaunicom.cn>
Reviewer's guide (collapsed on small PRs)Reviewer's GuideThis PR updates the Mediatek JPEG driver to only initialize and cancel the JPEG workqueue for multi-core hardware variants, avoiding warnings and incorrect work handling on single-core variants. Flow diagram for conditional JPEG work init/cancel on multi-core variantsflowchart TD
subgraph OpenPath[mtk_jpeg_open]
O_start([open]) --> O_check{jpeg.variant.multi_core}
O_check -- yes --> O_init[INIT_WORK ctx.jpeg_work jpeg.variant.jpeg_worker]
O_check -- no --> O_skip_init["skip INIT_WORK"]
end
subgraph ReleasePath[mtk_jpeg_release]
R_start([release]) --> R_check{jpeg.variant.multi_core}
R_check -- yes --> R_cancel[cancel_work_sync ctx.jpeg_work]
R_check -- no --> R_skip_cancel["skip cancel_work_sync"]
end
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Pull request overview
This PR fixes a release-path warning in the MediaTek JPEG V4L2 mem2mem driver by avoiding workqueue initialization/cancellation on single-core hardware variants that never use the per-context worker (and may have a NULL worker function pointer).
Changes:
- Guard
INIT_WORK(&ctx->jpeg_work, ...)behindjpeg->variant->multi_coreinmtk_jpeg_open(). - Guard
cancel_work_sync(&ctx->jpeg_work)behindjpeg->variant->multi_coreinmtk_jpeg_release().
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: opsiff The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
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.
Cc: stable@vger.kernel.org
Fixes: 34c519feef3e ("media: mtk-jpeg: fix use-after-free in release path due to uncancelled work")
Fixes: d40e952 ("media: mtk-jpeg: reconstructs the initialization mode of worker")
[WangYuli: Fix conflicts]
Link: https://lore.kernel.org/all/20260601073218.1281840-1-zhengxingda@iscas.ac.cn/
Summary by Sourcery
Bug Fixes: