CVE-2026-142797: media: s5p-mfc: use timer_shutdown_sync() for the self-rearming watchdog
In the Linux kernel, the following vulnerability has been resolved:
media: s5p-mfc: use timershutdownsync() for the self-rearming watchdog
The MFC watchdog timer (s5pmfcwatchdog) is self-rearming: every callback re-arms itself with addtimer() and, on a timeout, schedules watchdogwork. s5pmfcremove() tears this down with timerdeletesync() followed by flushwork().
timerdeletesync() dequeues the timer and waits for a callback that is already running, but it does not prevent a subsequent re-arm. Because the watchdog callback re-arms via addtimer(), this is the wrong shutdown primitive: once the wait returns nothing guarantees a just-queued re-arm will not fire later, dereferencing dev (clock on/off, deinithw, loadfirmware, inithw) after videounregisterdevice(), DMA teardown and s5pmfcfinalpm() have run, a potential use-after-free.
Use timershutdownsync(), which puts the timer into a shutdown state so that any addtimer()/modtimer() from the callback becomes a no-op and no later firing is possible. Switch flushwork() to cancelworksync() so any watchdogwork that was already queued before the timer was stopped is cancelled rather than allowed to run to completion against the torn-down device.
This issue was found by an in-house static analysis tool. No runtime reproducer is available.
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.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.117 - Upgrade
Upgrade
linux/Kernelto a version that resolves this vulnerability.Fixed in 6.18.61 - Upgrade
Upgrade
linux/Kernelto a version that resolves this vulnerability.Fixed in 7.3.2
Event History
Frequently Asked Questions
When can the use-after-free occur?
It can occur during s5p_mfc device removal if the self-rearming watchdog callback queues the timer again after timer_delete_sync() has returned. The rearmed timer or previously queued watchdog work can then access device state after video device unregistration, DMA teardown, and final power-management cleanup.
What does the fix change to prevent the race?
The fix replaces timer_delete_sync() with timer_shutdown_sync(), which prevents later add_timer() or mod_timer() calls from rearming the watchdog. It also replaces flush_work() with cancel_work_sync() so watchdog work queued before timer shutdown is cancelled rather than allowed to execute.