CVE-2026-138907: media: mediatek: jpeg: Avoid context access after job finish
In the Linux kernel, the following vulnerability has been resolved:
media: mediatek: jpeg: Avoid context access after job finish
v4l2m2mjobfinish() publishes job completion and wakes waiters before it returns. A concurrent file release can therefore finish v4l2m2mctxrelease() and free the context while the single-core IRQ handler continues with its tail.
Both handlers only need the device for the matching runtime PM put. Use the IRQ-owned jpeg pointer instead of dereferencing ctx after completion has been published. This preserves the get/put pairing and removes the post-completion context access.
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
linux/Kernelto a version that resolves this vulnerability.Fixed in 5.10.275 - Upgrade
Upgrade
linux/Kernelto a version that resolves this vulnerability.Fixed in 5.15.226 - Upgrade
Upgrade
linux/Kernelto a version that resolves this vulnerability.Fixed in 6.1.193 - Upgrade
Upgrade
linux/Kernelto a version that resolves this vulnerability.Fixed in 6.6.163 - Upgrade
Upgrade
linux/Kernelto a version that resolves this vulnerability.Fixed in 6.12.118 - Upgrade
Upgrade
linux/Kernelto a version that resolves this vulnerability.Fixed in 6.18.64 - Upgrade
Upgrade
linux/Kernelto a version that resolves this vulnerability.Fixed in 7.3.4 - Upgrade
Upgrade
debian/linuxto a version that resolves this vulnerability.Fixed in 6.12.118-1 - Upgrade
Upgrade
debian/linuxto a version that resolves this vulnerability.Fixed in 7.3.4-1 - Upgrade
Upgrade
debian/linuxto a version that resolves this vulnerability.Fixed in 6.12.118-1Fixed in 7.3.4-1 - Compensating control
In the MediaTek JPEG driver’s IRQ handlers, use the IRQ-owned JPEG pointer to obtain the device for the matching runtime PM put; do not dereference the context after v4l2_m2m_job_finish() publishes completion.
Event History
Frequently Asked Questions
What race condition triggers this issue?
The race occurs when the JPEG IRQ handler calls v4l2_m2m_job_finish(), which publishes completion and wakes waiters, while another thread concurrently releases the associated file and frees the V4L2 mem2mem context. The IRQ handler can then continue its tail processing and dereference the freed context.
Which execution path is involved?
The issue affects the single-core IRQ handler in the MediaTek JPEG driver. The handler only needs the device pointer to perform the matching runtime PM put after job completion, but previously accessed the context after completion had been published.
What does the fix change?
The fix makes the IRQ handler use its IRQ-owned JPEG device pointer rather than dereferencing the V4L2 context after calling v4l2_m2m_job_finish(). This retains the runtime PM get/put pairing while eliminating the post-completion context access.