{"id":"CVE-2026-99468","state":"PUBLISHED","title":"media: imx-jpeg: cancel timeout worker when streaming stops","description":"In the Linux kernel, the following vulnerability has been resolved:\n\nmedia: imx-jpeg: cancel timeout worker when streaming stops\n\nEach per-fd context ctx owns a delayed_work (ctx->task_timer, callback\nmxc_jpeg_device_run_timeout) armed via schedule_delayed_work() at the end\nof mxc_jpeg_device_run() to recover a stalled encode/decode job. The only\nexisting cancellation is cancel_delayed_work() in the frame-done IRQ\nhandler, which de-queues a pending work item but does not wait for a\ncallback that has already started, and it only runs when a frame completes.\n\nWhen the fd is closed while a job is in flight (the frame-done IRQ has not\nfired yet), nothing syncs the worker before mxc_jpeg_release() frees ctx\nwith kfree() after v4l2_m2m_ctx_release(). A queued or executing\nmxc_jpeg_device_run_timeout() can then recover ctx through\ncontainer_of(&ctx->task_timer) and dereference it (ctx->mxc_jpeg,\nslot_data, dev_warn) after ctx has been freed.\n\nCancel the worker from mxc_jpeg_stop_streaming(). The cancel cannot live\nin mxc_jpeg_release(): mxc_jpeg_device_run() arms the timer while holding\nonly hw_lock, not the mxc_jpeg->lock mutex that release holds, so a cancel\nin release could still race a concurrent mxc_jpeg_device_run() that\nre-arms the timer afterwards. mxc_jpeg_stop_streaming() instead runs inside\nv4l2_m2m_ctx_release() -> vb2_queue_release(), i.e. after\nv4l2_m2m_cancel_job() has set TRANS_ABORT and waited for any in-flight job\nto finish (so __v4l2_m2m_try_queue() will not queue and v4l2_m2m_try_run()\nwill not run any further job for this context, which prevents\nmxc_jpeg_device_run() from re-arming the timer) and before the m2m context\nis freed. cancel_delayed_work_sync() removes a pending work item and waits\nfor a running callback, so the worker can no longer race with the\nsubsequent kfree(). The cancel is placed before the buffer-release loop so\na concurrently running timeout callback cannot race with it over the same\nbuffers. If the frame-done IRQ canceled a still-pending timer, this cancel\nis a no-op; if the timeout callback has already started, it waits for the\ncallback to finish. The same mxc_jpeg_stop_streaming() call is also\nreached from VIDIOC_STREAMOFF, which drains the worker early, although\nSTREAMOFF itself does not free ctx -- the use-after-free arises only\nwhen the fd is later closed.\n\nThis bug was found by static analysis.","publishedAt":"2026-11-19T14:42:54.426Z","updatedAt":"2026-11-22T11:08:27.444Z","severity":{"score":7,"label":"High","version":"3.1","vector":"CVSS:3.1/AV:L/AC:H/PR:L/UI:N/S:U/C:H/I:H/A:H","source":"Linux"},"assigner":"Linux","products":["Linux Linux"],"affected":[{"vendor":"Linux","product":"Linux","defaultStatus":"unaffected","versions":[{"version":"cfed9632ca8e8bdf0128745ae2400b72c4292886","status":"affected","lessThan":"77e1c41d65a9f3cd22d73d0ec1f33cf6cd37b341","versionType":"git"},{"version":"cfed9632ca8e8bdf0128745ae2400b72c4292886","status":"affected","lessThan":"49a0623994a10d3d333d48c304f89d816495f332","versionType":"git"},{"version":"cfed9632ca8e8bdf0128745ae2400b72c4292886","status":"affected","lessThan":"9e393784a902bb4eb00a21e46d389a32c7ea61b0","versionType":"git"},{"version":"cfed9632ca8e8bdf0128745ae2400b72c4292886","status":"affected","lessThan":"78fdfbf117c409273eecbfa7a528ef42358a0e38","versionType":"git"},{"version":"1f3367fa4210f37417cd55622b3872ababd2f06d","status":"affected","versionType":"git"},{"version":"6.1.143","status":"affected","lessThan":"6.2","versionType":"semver"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.c"]},{"vendor":"Linux","product":"Linux","defaultStatus":"affected","versions":[{"version":"6.2","status":"affected"},{"version":"0","status":"unaffected","lessThan":"6.2","versionType":"semver"},{"version":"6.12.117","status":"unaffected","lessThanOrEqual":"6.12.*","versionType":"semver"},{"version":"6.18.61","status":"unaffected","lessThanOrEqual":"6.18.*","versionType":"semver"},{"version":"7.3.2","status":"unaffected","lessThanOrEqual":"7.3.*","versionType":"semver"},{"version":"7.4-rc1","status":"unaffected","lessThanOrEqual":"*","versionType":"original_commit_for_fix"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.c"]}],"references":["https://git.kernel.org/stable/c/77e1c41d65a9f3cd22d73d0ec1f33cf6cd37b341","https://git.kernel.org/stable/c/49a0623994a10d3d333d48c304f89d816495f332","https://git.kernel.org/stable/c/9e393784a902bb4eb00a21e46d389a32c7ea61b0","https://git.kernel.org/stable/c/78fdfbf117c409273eecbfa7a528ef42358a0e38"],"weaknesses":[],"ingestedAt":"2026-11-22T11:18:06.032Z","source":{"repository":"CVEProject/cvelistV5","path":"cves/2026/99xxx/CVE-2026-99468.json","commit":"247cc9beefd85903834df0592e88a44f4d599223","baselineCommit":"556c9d3a8cd17e218bb8e452ba7cd619a384ff47"},"raw":{"dataType":"CVE_RECORD","dataVersion":"5.2","cveMetadata":{"cveId":"CVE-2026-99468","state":"PUBLISHED","datePublished":"2026-11-19T14:42:54.426Z","dateUpdated":"2026-11-22T11:08:27.444Z","assignerShortName":"Linux","assignerOrgId":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","dateReserved":"2026-09-25T10:25:14.417Z"},"containers":{"cna":{"title":"media: imx-jpeg: cancel timeout worker when streaming stops","descriptions":[{"lang":"en","value":"In the Linux kernel, the following vulnerability has been resolved:\n\nmedia: imx-jpeg: cancel timeout worker when streaming stops\n\nEach per-fd context ctx owns a delayed_work (ctx->task_timer, callback\nmxc_jpeg_device_run_timeout) armed via schedule_delayed_work() at the end\nof mxc_jpeg_device_run() to recover a stalled encode/decode job. The only\nexisting cancellation is cancel_delayed_work() in the frame-done IRQ\nhandler, which de-queues a pending work item but does not wait for a\ncallback that has already started, and it only runs when a frame completes.\n\nWhen the fd is closed while a job is in flight (the frame-done IRQ has not\nfired yet), nothing syncs the worker before mxc_jpeg_release() frees ctx\nwith kfree() after v4l2_m2m_ctx_release(). A queued or executing\nmxc_jpeg_device_run_timeout() can then recover ctx through\ncontainer_of(&ctx->task_timer) and dereference it (ctx->mxc_jpeg,\nslot_data, dev_warn) after ctx has been freed.\n\nCancel the worker from mxc_jpeg_stop_streaming(). The cancel cannot live\nin mxc_jpeg_release(): mxc_jpeg_device_run() arms the timer while holding\nonly hw_lock, not the mxc_jpeg->lock mutex that release holds, so a cancel\nin release could still race a concurrent mxc_jpeg_device_run() that\nre-arms the timer afterwards. mxc_jpeg_stop_streaming() instead runs inside\nv4l2_m2m_ctx_release() -> vb2_queue_release(), i.e. after\nv4l2_m2m_cancel_job() has set TRANS_ABORT and waited for any in-flight job\nto finish (so __v4l2_m2m_try_queue() will not queue and v4l2_m2m_try_run()\nwill not run any further job for this context, which prevents\nmxc_jpeg_device_run() from re-arming the timer) and before the m2m context\nis freed. cancel_delayed_work_sync() removes a pending work item and waits\nfor a running callback, so the worker can no longer race with the\nsubsequent kfree(). The cancel is placed before the buffer-release loop so\na concurrently running timeout callback cannot race with it over the same\nbuffers. If the frame-done IRQ canceled a still-pending timer, this cancel\nis a no-op; if the timeout callback has already started, it waits for the\ncallback to finish. The same mxc_jpeg_stop_streaming() call is also\nreached from VIDIOC_STREAMOFF, which drains the worker early, although\nSTREAMOFF itself does not free ctx -- the use-after-free arises only\nwhen the fd is later closed.\n\nThis bug was found by static analysis."}],"affected":[{"vendor":"Linux","product":"Linux","defaultStatus":"unaffected","versions":[{"version":"cfed9632ca8e8bdf0128745ae2400b72c4292886","status":"affected","lessThan":"77e1c41d65a9f3cd22d73d0ec1f33cf6cd37b341","versionType":"git"},{"version":"cfed9632ca8e8bdf0128745ae2400b72c4292886","status":"affected","lessThan":"49a0623994a10d3d333d48c304f89d816495f332","versionType":"git"},{"version":"cfed9632ca8e8bdf0128745ae2400b72c4292886","status":"affected","lessThan":"9e393784a902bb4eb00a21e46d389a32c7ea61b0","versionType":"git"},{"version":"cfed9632ca8e8bdf0128745ae2400b72c4292886","status":"affected","lessThan":"78fdfbf117c409273eecbfa7a528ef42358a0e38","versionType":"git"},{"version":"1f3367fa4210f37417cd55622b3872ababd2f06d","status":"affected","versionType":"git"},{"version":"6.1.143","status":"affected","lessThan":"6.2","versionType":"semver"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.c"]},{"vendor":"Linux","product":"Linux","defaultStatus":"affected","versions":[{"version":"6.2","status":"affected"},{"version":"0","status":"unaffected","lessThan":"6.2","versionType":"semver"},{"version":"6.12.117","status":"unaffected","lessThanOrEqual":"6.12.*","versionType":"semver"},{"version":"6.18.61","status":"unaffected","lessThanOrEqual":"6.18.*","versionType":"semver"},{"version":"7.3.2","status":"unaffected","lessThanOrEqual":"7.3.*","versionType":"semver"},{"version":"7.4-rc1","status":"unaffected","lessThanOrEqual":"*","versionType":"original_commit_for_fix"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.c"]}],"references":[{"url":"https://git.kernel.org/stable/c/77e1c41d65a9f3cd22d73d0ec1f33cf6cd37b341"},{"url":"https://git.kernel.org/stable/c/49a0623994a10d3d333d48c304f89d816495f332"},{"url":"https://git.kernel.org/stable/c/9e393784a902bb4eb00a21e46d389a32c7ea61b0"},{"url":"https://git.kernel.org/stable/c/78fdfbf117c409273eecbfa7a528ef42358a0e38"}],"metrics":[{"cvssV3_1":{"version":"3.1","vectorString":"CVSS:3.1/AV:L/AC:H/PR:L/UI:N/S:U/C:H/I:H/A:H","baseScore":7,"baseSeverity":"HIGH"},"scenarios":[{"lang":"en","value":"AV:L - A local process opens the node registered in mxc_jpeg_probe() and, via VIDIOC_QBUF/STREAMON, v4l2_m2m_try_run() calls mxc_jpeg_device_run() to arm ctx->task_timer. close() reaches mxc_jpeg_release() -> v4l2_m2m_ctx_release() -> mxc_jpeg_stop_streaming() and then kfree(ctx); no remote protocol carries the trigger.\nAC:H - v4l2_m2m_ctx_release() waits in v4l2_m2m_cancel_job() until TRANS_RUNNING clears, and mxc_jpeg_dec_irq() cancel_delayed_work()s ctx->task_timer before v4l2_m2m_job_finish(). The UAF needs the 2000ms mxc_jpeg_device_run_timeout() callback to already be running and still touch ctx after that wait; a normal frame-done disarms a pending timer, and the attacker cannot force that overlap.\nPR:L - mxc_jpeg_open() and the streaming ioctls in mxc_jpeg_ioctl_ops (VIDIOC_QBUF, VIDIOC_STREAMON) never call capable(). Any local user who can open the /dev/video node can queue a job and close the fd; CAP_SYS_ADMIN is only checked for unrelated v4l2 debug-register ioctls.\nUI:N - The same process opens the node, queues a buffer, starts streaming so mxc_jpeg_device_run() arms the timer, and closes the fd. No other user has to mount media or take an action.\nS:U - The object freed by mxc_jpeg_release() is the host-kernel mxc_jpeg_ctx allocated in mxc_jpeg_open(). The timeout callback's later use of that ctx stays inside the same kernel security domain.\nC:H - mxc_jpeg_device_run_timeout() rebuilds ctx with container_of() on the embedded task_timer and reads ctx->mxc_jpeg and ctx->fh.m2m_ctx after kfree(). Those fields sit in the kmalloc slab, so reclaiming the object feeds attacker-controlled kernel pointers into the callback.\nI:H - On that freed ctx the callback spin_lock()s ctx->mxc_jpeg->hw_lock and, when slot_data.used is set, calls mxc_jpeg_job_finish() and v4l2_m2m_job_finish(). That writes kernel memory through the reclaimed mxc_jpeg and m2m_ctx pointers.\nA:H - The callback runs in kernel worker context. After kfree(ctx), its first dereference of ctx->mxc_jpeg and the hw_lock acquisition fault or oops the kernel, and mxc_jpeg_job_finish() will also walk freed m2m buffers."}]}],"providerMetadata":{"shortName":"Linux","orgId":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","dateUpdated":"2026-11-22T11:08:27.444Z"},"cpeApplicability":[{"nodes":[{"operator":"OR","negate":false,"cpeMatch":[{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"6.2","versionEndExcluding":"6.12.117"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"6.2","versionEndExcluding":"6.18.61"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"6.2","versionEndExcluding":"7.3.2"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"6.2","versionEndExcluding":"7.4-rc1"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"6.1.143"}]}]}],"x_generator":{"engine":"bippy-1.2.0"}}}}}