Description
In the Linux kernel, the following vulnerability has been resolved:

media: mtk-jpeg: fix use-after-free in release path due to uncancelled work

The mtk_jpeg_release() function frees the context structure (ctx) without
first cancelling any pending or running work in ctx->jpeg_work. This
creates a race window where the workqueue callback may still be accessing
the context memory after it has been freed.

Race condition:

CPU 0 (release) CPU 1 (workqueue)
---------------- ------------------
close()
mtk_jpeg_release()
mtk_jpegenc_worker()
ctx = work->data
// accessing ctx

kfree(ctx) // freed!
access ctx // UAF!

The work is queued via queue_work() during JPEG encode/decode operations
(via mtk_jpeg_device_run). If the device is closed while work is pending
or running, the work handler will access freed memory.

Fix this by calling cancel_work_sync() BEFORE acquiring the mutex. This
ordering is critical: if cancel_work_sync() is called after mutex_lock(),
and the work handler also tries to acquire the same mutex, it would cause
a deadlock.

Note: The open error path does NOT need cancel_work_sync() because
INIT_WORK() only initializes the work structure - it does not schedule
it. Work is only scheduled later during ioctl operations.
Published: 2026-05-27
Score: 7.8 High
EPSS: < 1% Very Low
KEV: No
Impact: n/a
Action: n/a
AI Analysis

Impact

A race condition exists in the MediaTek JPEG driver of the Linux kernel where the mtk_jpeg_release() function frees its context structure before canceling any pending work; this results in a use‑after‑free that corrupts kernel memory. The primary impact is local kernel memory corruption that could enable a local attacker to gain elevated privileges or crash the system, reflecting CWE-825 weaknesses.

Affected Systems

The vulnerability resides in the kernel's media subsystem for MediaTek devices, specifically in the mtk_jpeg component. It affects all Linux kernel releases that include this driver and have not yet incorporated the commit that performs cancel_work_sync() before freeing ctx. Vendors listed by the CNA are Linux:Linux, meaning any Linux distribution whose kernel contains this driver may be vulnerable. Exact version ranges are not disclosed, but any system that has not applied the patch referenced in the provided commit logs remains affected.

Risk and Exploitability

The CVSS score of 7.8 denotes high severity, yet the EPSS score is less than 1 % and the vulnerability is not listed in the CISA KEV catalog, indicating a low probability of widespread exploitation. Based on the description, the attack vector requires local access and the ability to open the JPEG device; an attacker would need to initiate an encode or decode operation, then close the device while work is pending. Because the work runs in the kernel, the threat is limited to privileged or local users that have access to the device file. If successful, the attacker could trigger a kernel panic or achieve privilege escalation, but remote code execution is not implied by the current data.

Generated by OpenCVE AI on May 30, 2026 at 15:21 UTC.

Remediation

No vendor fix or workaround currently provided.

OpenCVE Recommended Actions

  • Update the kernel to a revision that includes the commit adding cancel_work_sync() before releasing ctx in mtk_jpeg_release()
  • If an update is not possible, unload or blacklist the mtk_jpeg kernel module to prevent the driver from loading
  • If the module must remain available, ensure that applications do not close the JPEG device while a run operation is outstanding; otherwise modify the driver or add a wrapper that invokes cancel_work_sync() before device close

Generated by OpenCVE AI on May 30, 2026 at 15:21 UTC.

Tracking

Sign in to view the affected projects.

Advisories

No advisories yet.

History

Tue, 16 Jun 2026 15:30:00 +0000

Type Values Removed Values Added
Weaknesses CWE-416

Sat, 30 May 2026 14:15:00 +0000

Type Values Removed Values Added
Weaknesses CWE-416

Sat, 30 May 2026 11:00:00 +0000

Type Values Removed Values Added
Metrics cvssV3_1

{'score': 7.8, 'vector': 'CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H'}


Thu, 28 May 2026 00:15:00 +0000


Wed, 27 May 2026 19:00:00 +0000

Type Values Removed Values Added
Weaknesses CWE-416

Wed, 27 May 2026 14:15:00 +0000

Type Values Removed Values Added
Description In the Linux kernel, the following vulnerability has been resolved: media: mtk-jpeg: fix use-after-free in release path due to uncancelled work The mtk_jpeg_release() function frees the context structure (ctx) without first cancelling any pending or running work in ctx->jpeg_work. This creates a race window where the workqueue callback may still be accessing the context memory after it has been freed. Race condition: CPU 0 (release) CPU 1 (workqueue) ---------------- ------------------ close() mtk_jpeg_release() mtk_jpegenc_worker() ctx = work->data // accessing ctx kfree(ctx) // freed! access ctx // UAF! The work is queued via queue_work() during JPEG encode/decode operations (via mtk_jpeg_device_run). If the device is closed while work is pending or running, the work handler will access freed memory. Fix this by calling cancel_work_sync() BEFORE acquiring the mutex. This ordering is critical: if cancel_work_sync() is called after mutex_lock(), and the work handler also tries to acquire the same mutex, it would cause a deadlock. Note: The open error path does NOT need cancel_work_sync() because INIT_WORK() only initializes the work structure - it does not schedule it. Work is only scheduled later during ioctl operations.
Title media: mtk-jpeg: fix use-after-free in release path due to uncancelled work
First Time appeared Linux
Linux linux Kernel
CPEs cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*
Vendors & Products Linux
Linux linux Kernel
References

Subscriptions

Linux Linux Kernel
cve-icon MITRE

Status: PUBLISHED

Assigner: Linux

Published:

Updated: 2026-06-14T17:47:51.841Z

Reserved: 2026-05-13T15:03:33.092Z

Link: CVE-2026-46011

cve-icon Vulnrichment

No data.

cve-icon NVD

Status : Analyzed

Published: 2026-05-27T14:17:19.250

Modified: 2026-06-16T15:25:13.650

Link: CVE-2026-46011

cve-icon Redhat

Severity :

Publid Date: 2026-05-27T00:00:00Z

Links: CVE-2026-46011 - Bugzilla

cve-icon OpenCVE Enrichment

Updated: 2026-05-30T15:30:26Z

Weaknesses