CVE-2026-139405: thermal/drivers/ti-soc-thermal: Cancel pending alert work on remove
In the Linux kernel, the following vulnerability has been resolved:
thermal/drivers/ti-soc-thermal: Cancel pending alert work on remove
On a threshold crossing, the talert IRQ handler calls tithermalreportsensortemperature(), which queues the work embedded in the sensor's tithermaldata on the system workqueue. Nothing ever cancels or flushes that work.
tibandgapremove() frees the talert IRQ last. freeirq() waits for a running handler, but not for the work the handler has queued. When remove returns, devres unregisters and frees the thermal zones and then frees the devm-allocated tithermaldata, so a work item that is still pending runs tithermalwork() on freed memory:
tithermalwork() data = containerof(work, struct tithermaldata, thermalwq); thermalzonedeviceupdate(data->tithermal, ...);
Free the talert IRQ before removing the sensors, so that no new work can be queued, and cancel the work in tithermalremovesensor().
This needs an OMAP4460/4470 or OMAP5 SoC (DRA7 has TALERT but no ->reporttemperature, so it never queues the work), a threshold crossing just before the driver is unbound or unloaded, and the work still pending when devres frees the data.
Found by static analysis tool CodeQL.
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Compensating control
In the TI SoC thermal driver, free the TALERT IRQ before removing sensors and cancel pending alert work in ti_thermal_remove_sensor().
Event History
Frequently Asked Questions
Which systems are affected by this issue?
The issue requires an OMAP4460, OMAP4470, or OMAP5 SoC using the affected TI SoC thermal driver. DRA7 is not affected because, although it has TALERT support, it does not implement report_temperature and therefore does not queue the vulnerable work.
What conditions are required to trigger the use-after-free?
A thermal threshold crossing must queue alert work immediately before the driver is unbound or unloaded. The queued work must still be pending when driver-managed resources free the thermal data.
What happens if the vulnerable sequence occurs?
Pending thermal work can execute after the driver's ti_thermal_data structure and thermal zones have been freed. The work then accesses freed memory while attempting to update the thermal zone.
What does the fix change?
The fix frees the TALERT IRQ before removing sensors so new work cannot be queued, and cancels pending work during sensor removal.