Skip to main content
Vulnerability Database/CVE-2026-98198

CVE-2026-98198: Linux Kernel Use-After-Free Vulnerability

CVE-2026-98198 is a use-after-free flaw in the Linux kernel hwmon pwm-fan driver that can cause memory corruption when the RPM timer accesses freed data during device detach. This article covers technical details, impact, and mitigation.

Published:

Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

Sources: National Vulnerability Database, CISA KEV, Exploit-DB

CVE-2026-98198 Overview

CVE-2026-98198 is a use-after-free vulnerability in the Linux kernel pwm-fan hardware monitoring driver. The flaw lives in the RPM sampling path, where sample_timer() rearms a timer that reads devm-managed ctx->tachs and ctx->pulses_per_revolution arrays. Because the cleanup action that stops the timer is registered before those arrays are allocated, devres releases them in the wrong order during driver detach. A timer expiry during the unbind window accesses freed tach data. KASAN testing confirmed three four-byte reads and two four-byte writes in sample_timer() after the backing allocations were released.

Critical Impact

A race between driver unbind and timer expiry allows the sample_timer() callback to read and write freed kernel memory, enabling potential kernel memory corruption on systems using the pwm-fan driver.

Affected Products

  • Linux kernel hwmon subsystem, pwm-fan driver
  • Stable kernel branches referenced by commits 1e824fd, 26d5ff7, a5ce3fe, and b48339b
  • Systems using PWM-controlled fans with tachometer feedback (common on ARM SBCs and embedded Linux platforms)

Discovery Timeline

  • 2026-10-06 - CVE-2026-98198 published to NVD
  • 2026-10-06 - Last updated in NVD database

Technical Details for CVE-2026-98198

Vulnerability Analysis

The pwm-fan driver uses the kernel devres (device-managed resource) framework to automate cleanup during driver detach. Devres releases registered actions in reverse order of registration. In the vulnerable code, the action that calls pwm_fan_cleanup() to stop the RPM sampling timer is registered before the ctx->tachs and ctx->pulses_per_revolution arrays are allocated as devm-managed memory.

During driver unbind, the devm allocations for the tach arrays are freed first because they were registered later. The timer-stop action runs afterward. If sample_timer() fires in that window, it rearms itself and dereferences the already-freed tach memory, producing a classic use-after-free [CWE-416].

KASAN instrumentation combined with a kprobe that delayed entry to pwm_fan_cleanup() reliably reproduced three four-byte reads and two four-byte writes to freed memory per unbind cycle. The upstream fix splits timer retirement from the power cleanup action and registers the timer action only after the tach data and IRQ handlers are installed. The fix also uses timer_shutdown_sync() because the callback can rearm itself.

Root Cause

The root cause is incorrect ordering of devm_add_action*() registrations relative to resource allocation. The developer registered the cleanup callback that depends on the tach arrays before those arrays were allocated through devres. This inverted the destruction order and created a window where the timer callback outlived its backing data.

Attack Vector

Triggering the condition requires the ability to unbind the pwm-fan driver, typically through sysfs writes to /sys/bus/platform/drivers/pwm-fan/unbind. On most distributions this requires root or CAP_SYS_ADMIN. The impact is local kernel memory corruption during the unbind race. No remote attack vector is documented, and no public exploit is available.

See the upstream fix commits for the exact code changes: Kernel Git Commit 1e824fd, Kernel Git Commit 26d5ff7, Kernel Git Commit a5ce3fe, and Kernel Git Commit b48339b.

Detection Methods for CVE-2026-98198

Indicators of Compromise

  • KASAN reports naming sample_timer in the call stack with use-after-free annotations on pwm-fan allocations
  • Kernel BUG, WARNING, or Oops messages referencing pwm_fan or hwmon during driver unbind or module removal
  • Unexpected hwmon sysfs read failures or stale RPM values after device teardown

Detection Strategies

  • Run KASAN-enabled test kernels on platforms that ship the pwm-fan driver and exercise bind/unbind cycles under load
  • Audit running kernel versions against the fix commits listed in the NVD references to confirm patch presence
  • Monitor /var/log/kern.log and dmesg output for memory corruption traces following device hot-unplug or driver reload

Monitoring Recommendations

  • Collect kernel ring buffer logs centrally and alert on KASAN, use-after-free, and slab-use-after-free substrings
  • Track driver bind and unbind events on embedded fleets where pwm-fan is active
  • Correlate unexplained kernel panics on ARM SBCs or embedded Linux devices with hwmon activity

How to Mitigate CVE-2026-98198

Immediate Actions Required

  • Update affected Linux systems to a kernel release that includes commits 1e824fd, 26d5ff7, a5ce3fe, or b48339b
  • Avoid dynamic unbind operations on the pwm-fan driver until patches are applied
  • Restrict access to platform driver sysfs unbind interfaces to trusted administrators only

Patch Information

The fix is upstream in the Linux kernel stable tree. It splits timer retirement from power cleanup, registers the timer devres action only after the tach backing data and IRQ actions are installed, and uses timer_shutdown_sync() to safely retire a self-rearming timer. Review the stable backports at the four kernel.org commits listed in the external references and apply the appropriate backport for your kernel branch.

Workarounds

  • Blacklist the pwm-fan module on systems that do not require active fan speed monitoring using /etc/modprobe.d/
  • Ensure the pwm-fan driver is not unbound at runtime; keep devices bound for the lifetime of the system
  • Restrict CAP_SYS_ADMIN and limit write access to /sys/bus/platform/drivers/pwm-fan/ paths through standard Linux access controls
bash
# Verify running kernel and check for the pwm-fan driver
uname -r
lsmod | grep pwm_fan

# Prevent runtime unbind by removing write permission on the unbind sysfs entry
chmod 0200 /sys/bus/platform/drivers/pwm-fan/unbind 2>/dev/null || true

# Optional: blacklist the module if fan monitoring is not required
echo 'blacklist pwm-fan' > /etc/modprobe.d/blacklist-pwm-fan.conf

Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

Sources: National Vulnerability Database, CISA KEV, Exploit-DB

Experience the Most Advanced Cybersecurity Platform

See how the world’s most intelligent, autonomous cybersecurity platform can protect your organization today and into the future.