[PATCH 1/3] media: nxp: imx-jpeg: cancel task_timer before freeing ctx
Shengzhuo Wei
me at cherr.cc
Mon Aug 24 20:39:14 PDT 2026
On 2026-08-25 10:56, Ming Qian(OSS) wrote:
> Hi Shengzhuo,
>
> Thanks for the patch.
>
> This use-after-free has already been fixed by Fan Wu:
> https://lore.kernel.org/lkml/20260623103031.3051-1-fanwu01@zju.edu.cn/
> [PATCH] media: imx-jpeg: cancel timeout worker when streaming stops
>
> Regards,
> Ming
>
Hi Ming,
Thanks for pointing me at Fan Wu's patch -- I had missed it (it is not
in the 7.2-rc6 base I worked from, and I failed to check for in-flight
patches on the list before sending). His version is also the better
one: placing the cancel in mxc_jpeg_stop_streaming() closes the
re-arm window that a cancel in mxc_jpeg_release() leaves open, which
Sashiko also flagged on my 1/3. I'll drop that patch.
The other two patches in the series (hantro watchdog, mtk-jpeg
job_timeout_work) fix the same class of bug in different drivers and,
as far as I can tell, have no equivalent fix in flight. Sashiko raised
one real point on the mtk patch: jpeg->job_timeout_work is only
initialized on the single-core path, so the unconditional
cancel_delayed_work_sync() in mtk_jpeg_remove() would hit a zeroed
work struct (WARN_ON(!work->func)) on multi-core variants. I plan to
send a v2 that drops the imx-jpeg patch and guards the mtk cancel
accordingly.
Do you see anything else in the remaining two patches you'd like
changed before I send the v2?
Regards,
Shengzhuo
More information about the linux-arm-kernel
mailing list