{"id":"CVE-2026-31731","aliases":["CVE-2026-31731"],"related":[],"kind":"vulnerability","state":"published","title":"thermal: core: Address thermal zone removal races with resume","summary":"In the Linux kernel, the following vulnerability has been resolved:\n\nthermal: core: Address thermal zone removal races with resume\n\nSince thermal_zone_pm_complete() and thermal_zone_device_resume()\nre-initialize the poll_queue delayed work for the given thermal zone,\nthe cancel_delayed_work_sync() in thermal_zone_device_unregister()\nmay miss some already running work items and the thermal zone may\nbe freed prematurely [1].\n\nThere are two failing scenarios that both start with\nrunning thermal_pm_notify_complete() right before invoking\nthermal_zone_device_unregister() for one of the thermal zones.\n\nIn the first scenario, there is a work item already running for\nthe given thermal zone when thermal_pm_notify_complete() calls\nthermal_zone_pm_complete() for that thermal zone and it continues to\nrun when thermal_zone_device_unregister() starts.  Since the poll_queue\ndelayed work has been re-initialized by thermal_pm_notify_complete(), the\nrunning work item will be missed by the cancel_delayed_work_sync() in\nthermal_zone_device_unregister() and if it continues to run past the\nfreeing of the thermal zone object, a use-after-free will occur.\n\nIn the second scenario, thermal_zone_device_resume() queued up by\nthermal_pm_notify_complete() runs right after the thermal_zone_exit()\ncalled by thermal_zone_device_unregister() has returned.  The poll_queue\ndelayed work is re-initialized by it before cancel_delayed_work_sync() is\ncalled by thermal_zone_device_unregister(), so it may continue to run\nafter the freeing of the thermal zone object, which also leads to a\nuse-after-free.\n\nAddress the first failing scenario by ensuring that no thermal work\nitems will be running when thermal_pm_notify_complete() is called.\nFor this purpose, first move the cancel_delayed_work() call from\nthermal_zone_pm_complete() to thermal_zone_pm_prepare() to prevent\nnew work from entering the workqueue going forward.  Next, switch\nover to using a dedicated workqueue for thermal events and update\nthe code in thermal_pm_notify() to flush that workqueue after\nthermal_pm_notify_prepare() has returned which will take care of\nall leftover thermal work already on the workqueue (that leftover\nwork would do nothing useful anyway because all of the thermal zones\nhave been flagged as suspended).\n\nThe second failing scenario is addressed by adding a tz->state check\nto thermal_zone_device_resume() to prevent it from re-initializing\nthe poll_queue delayed work if the thermal zone is going away.\n\nNote that the above changes will also facilitate relocating the suspend\nand resume of thermal zones closer to the suspend and resume of devices,\nrespectively.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"In the Linux kernel, the following vulnerability has been resolved:\n\nthermal: core: Address thermal zone removal races with resume\n\nSince thermal_zone_pm_complete() and thermal_zone_device_resume()\nre-initialize the poll_queue delayed work for the given thermal zone,\nthe cancel_delayed_work_sync() in thermal_zone_device_unregister()\nmay miss some already running work items and the thermal zone may\nbe freed prematurely [1].\n\nThere are two failing scenarios that both start with\nrunning thermal_pm_notify_complete() right before invoking\nthermal_zone_device_unregister() for one of the thermal zones.\n\nIn the first scenario, there is a work item already running for\nthe given thermal zone when thermal_pm_notify_complete() calls\nthermal_zone_pm_complete() for that thermal zone and it continues to\nrun when thermal_zone_device_unregister() starts.  Since the poll_queue\ndelayed work has been re-initialized by thermal_pm_notify_complete(), the\nrunning work item will be missed by the cancel_delayed_work_sync() in\nthermal_zone_device_unregister() and if it continues to run past the\nfreeing of the thermal zone object, a use-after-free will occur.\n\nIn the second scenario, thermal_zone_device_resume() queued up by\nthermal_pm_notify_complete() runs right after the thermal_zone_exit()\ncalled by thermal_zone_device_unregister() has returned.  The poll_queue\ndelayed work is re-initialized by it before cancel_delayed_work_sync() is\ncalled by thermal_zone_device_unregister(), so it may continue to run\nafter the freeing of the thermal zone object, which also leads to a\nuse-after-free.\n\nAddress the first failing scenario by ensuring that no thermal work\nitems will be running when thermal_pm_notify_complete() is called.\nFor this purpose, first move the cancel_delayed_work() call from\nthermal_zone_pm_complete() to thermal_zone_pm_prepare() to prevent\nnew work from entering the workqueue going forward.  Next, switch\nover to using a dedicated workqueue for thermal events and update\nthe code in thermal_pm_notify() to flush that workqueue after\nthermal_pm_notify_prepare() has returned which will take care of\nall leftover thermal work already on the workqueue (that leftover\nwork would do nothing useful anyway because all of the thermal zones\nhave been flagged as suspended).\n\nThe second failing scenario is addressed by adding a tz->state check\nto thermal_zone_device_resume() to prevent it from re-initializing\nthe poll_queue delayed work if the thermal zone is going away.\n\nNote that the above changes will also facilitate relocating the suspend\nand resume of thermal zones closer to the suspend and resume of devices,\nrespectively.","source":"cvelist"},{"lang":"es","text":"En el kernel de Linux, la siguiente vulnerabilidad ha sido resuelta:\n\nthermal: core: Abordar las condiciones de carrera en la eliminación de zonas térmicas con la reanudación\n\nDado que thermal_zone_pm_complete() y thermal_zone_device_resume() reinicializan el trabajo retrasado de poll_queue para la zona térmica dada, el cancel_delayed_work_sync() en thermal_zone_device_unregister() puede pasar por alto algunos elementos de trabajo ya en ejecución y la zona térmica puede ser liberada prematuramente [1].\n\nHay dos escenarios de fallo que ambos comienzan con la ejecución de thermal_pm_notify_complete() justo antes de invocar thermal_zone_device_unregister() para una de las zonas térmicas.\n\nEn el primer escenario, hay un elemento de trabajo ya en ejecución para la zona térmica dada cuando thermal_pm_notify_complete() llama a thermal_zone_pm_complete() para esa zona térmica y continúa ejecutándose cuando thermal_zone_device_unregister() comienza. Dado que el trabajo retrasado de poll_queue ha sido reinicializado por thermal_pm_notify_complete(), el elemento de trabajo en ejecución será pasado por alto por el cancel_delayed_work_sync() en thermal_zone_device_unregister() y si continúa ejecutándose después de la liberación del objeto de la zona térmica, ocurrirá un uso después de liberación.\n\nEn el segundo escenario, thermal_zone_device_resume() encolado por thermal_pm_notify_complete() se ejecuta justo después de que thermal_zone_exit() llamado por thermal_zone_device_unregister() haya regresado. El trabajo retrasado de poll_queue es reinicializado por este antes de que cancel_delayed_work_sync() sea llamado por thermal_zone_device_unregister(), por lo que puede continuar ejecutándose después de la liberación del objeto de la zona térmica, lo que también conduce a un uso después de liberación.\n\nAbordar el primer escenario de fallo asegurando que ningún elemento de trabajo térmico estará en ejecución cuando se llame a thermal_pm_notify_complete(). Para este propósito, primero mover la llamada a cancel_delayed_work() de thermal_zone_pm_complete() a thermal_zone_pm_prepare() para evitar que nuevo trabajo entre en la cola de trabajo en adelante. A continuación, cambiar a usar una cola de trabajo dedicada para eventos térmicos y actualizar el código en thermal_pm_notify() para vaciar esa cola de trabajo después de que thermal_pm_notify_prepare() haya regresado, lo que se encargará de todo el trabajo térmico restante ya en la cola de trabajo (ese trabajo restante no haría nada útil de todos modos porque todas las zonas térmicas han sido marcadas como suspendidas).\n\nEl segundo escenario de fallo se aborda añadiendo una comprobación de tz  ->  state a thermal_zone_device_resume() para evitar que reinicialice el trabajo retrasado de poll_queue si la zona térmica está desapareciendo.\n\nTenga en cuenta que los cambios anteriores también facilitarán la reubicación de la suspensión y reanudación de las zonas térmicas más cerca de la suspensión y reanudación de los dispositivos, respectivamente.","source":"nvd"}],"published":"2026-05-01T14:14:30.177Z","modified":"2026-11-11T21:10:00.200Z","severity":{"scorer":"Linux","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H","score":7.8,"rating":"HIGH"},"severities":[{"scorer":"Linux","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H","score":7.8,"rating":"HIGH"},{"scorer":"NVD","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H","score":7.8,"rating":"HIGH"}],"cwes":["CWE-362","CWE-416"],"affected":[{"ranges":[{"type":"git","introduced":"5a5efdaffda5d23717d9117cf36cda9eafcf2fae","fixed":"1a6d2b001eb730d85f00da39ae7db6f3b4edc540","status":"affected"},{"type":"git","introduced":"5a5efdaffda5d23717d9117cf36cda9eafcf2fae","fixed":"2dbe93f344f10b432b95a23304006be805c097a1","status":"affected"},{"type":"git","introduced":"5a5efdaffda5d23717d9117cf36cda9eafcf2fae","fixed":"c4593f1654f7dea3bcf9bb1851ded86311d4f370","status":"affected"},{"type":"git","introduced":"5a5efdaffda5d23717d9117cf36cda9eafcf2fae","fixed":"45b859b0728267a6199ee5002d62e6c6f3e8c89d","status":"affected"}],"vendor":"Linux","product":"Linux","repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","source":"cvelist"},{"ranges":[{"version":"6.8","status":"affected"},{"type":"semver","introduced":"0","fixed":"6.8","status":"unaffected"},{"type":"semver","introduced":"6.12.83","lastAffected":"6.12.*","status":"unaffected"},{"type":"semver","introduced":"6.18.22","lastAffected":"6.18.*","status":"unaffected"},{"type":"semver","introduced":"6.19.12","lastAffected":"6.19.*","status":"unaffected"},{"type":"original_commit_for_fix","introduced":"7.0","lastAffected":"*","status":"unaffected"}],"vendor":"Linux","product":"Linux","repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","source":"cvelist"},{"ranges":[{"status":"affected","introduced":"6.8","fixed":"6.12.83"},{"status":"affected","introduced":"6.13","fixed":"6.18.22"},{"status":"affected","introduced":"6.19","fixed":"6.19.12"},{"status":"affected","version":"7.0"},{"status":"affected","version":"7.0"},{"status":"affected","version":"7.0"},{"status":"affected","version":"7.0"},{"status":"affected","version":"7.0"},{"status":"affected","version":"7.0"}],"vendor":"linux","product":"linux_kernel","cpe":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","source":"nvd"}],"references":[{"url":"https://git.kernel.org/stable/c/1a6d2b001eb730d85f00da39ae7db6f3b4edc540","tags":["patch"],"sources":["cvelist","nvd"]},{"url":"https://git.kernel.org/stable/c/2dbe93f344f10b432b95a23304006be805c097a1","tags":["patch"],"sources":["cvelist","nvd"]},{"url":"https://git.kernel.org/stable/c/c4593f1654f7dea3bcf9bb1851ded86311d4f370","tags":["patch"],"sources":["cvelist","nvd"]},{"url":"https://git.kernel.org/stable/c/45b859b0728267a6199ee5002d62e6c6f3e8c89d","tags":["patch"],"sources":["cvelist","nvd"]}],"credits":[],"assigner":"Linux","ssvc":{"scorer":"CISA-ADP","exploitation":"none","automatable":"no","technicalImpact":"total","date":"2026-10-16T15:12:52.594Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2026-31731","url":"https://www.cve.org/CVERecord?id=CVE-2026-31731","licence":"CVE Terms of Use","modified":"2026-10-19T19:06:07.291Z"},{"source":"nvd","name":"NVD","id":"CVE-2026-31731","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-31731","licence":"Public domain","modified":"2026-11-11T21:10:00.200Z"}],"updatedAt":"2026-11-25T22:59:20.356Z","epss":{"score":0.00101,"percentile":0.00938,"date":"2026-12-01T12:00:22.000Z"}}