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

CVE-2026-98015: Linux Kernel E-Switch Use-After-Free

CVE-2026-98015 is a use-after-free vulnerability in the Linux kernel E-Switch component affecting mlx5_eswitch_termtbl_put function. This race condition allows memory corruption through concurrent access. This post covers technical details, affected versions, impact assessment, and mitigation strategies.

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-98015 Overview

CVE-2026-98015 is a use-after-free vulnerability in the Linux kernel's Mellanox mlx5 E-Switch subsystem. The flaw resides in mlx5_eswitch_termtbl_put(), where the zero-reference cleanup check reads tt->ref_count after termtbl_mutex has been released. Two concurrent callers operating on the same mlx5_termtbl_handle can race: one decrements the reference count to zero, removes the hash entry, and calls kfree(tt), while the other evaluates if (!tt->ref_count) on freed memory. The upstream fix captures the decrement result into a stack-local variable so the cleanup decision occurs entirely under the mutex and tt is never touched after kfree.

Critical Impact

Concurrent E-Switch termination table operations can trigger a kernel use-after-free, leading to memory corruption, kernel crashes, or potential privilege escalation on systems running affected Mellanox mlx5 network drivers.

Affected Products

  • Linux kernel versions containing the vulnerable mlx5_eswitch_termtbl_put() implementation in the net/mlx5 E-Switch driver
  • Systems using Mellanox ConnectX adapters with E-Switch termination table offload enabled
  • Distributions shipping unpatched stable kernels prior to the fix commits referenced upstream

Discovery Timeline

  • 2026-09-25 - CVE-2026-98015 published to NVD
  • 2026-09-25 - Last updated in NVD database

Technical Details for CVE-2026-98015

Vulnerability Analysis

The vulnerability is a classic use-after-free [CWE-416] triggered by a race condition [CWE-362] in the Mellanox mlx5 Ethernet switch driver. The mlx5_eswitch_termtbl_put() function manages reference counting for termination table handles used in E-Switch flow offload. The original code decremented tt->ref_count while holding termtbl_mutex, released the mutex, and then re-read tt->ref_count to decide whether to free the structure.

This read-after-unlock pattern creates a time window where another CPU can complete its own decrement, observe a zero count, remove the hash entry, and call kfree(tt). When the first thread resumes and dereferences tt->ref_count, it reads memory that has already been freed and potentially reallocated.

Root Cause

The root cause is incorrect lock scoping. The cleanup decision depends on shared state (tt->ref_count) but was evaluated outside the critical section that protects that state. Any check-then-act sequence against shared refcounted data must occur atomically under the governing lock. The fix stores the post-decrement value into a stack-local last variable inside the locked region, so the subsequent cleanup branch depends only on local state and never re-reads the heap object after unlocking.

Attack Vector

Exploitation requires the ability to trigger concurrent flow-rule operations that exercise E-Switch termination table reference-count paths on the same mlx5_termtbl_handle. This typically means local workloads that create and tear down offloaded TC flower rules or OVS flows at high rates against an affected ConnectX adapter. A successful race produces kernel memory corruption, which can manifest as a crash (denial of service) or, under favorable heap grooming conditions, be weaponized toward privilege escalation.

No public proof-of-concept is referenced in the advisory. See the upstream commits for implementation details: Kernel Git Commit 18b2969, Kernel Git Commit 304ea40, Kernel Git Commit 7ee07f6, and Kernel Git Commit e393789.

Detection Methods for CVE-2026-98015

Indicators of Compromise

  • Unexpected kernel oops or panic entries referencing mlx5_eswitch_termtbl_put, mlx5_eswitch_termtbl_get_create, or the mlx5_core module in dmesg and /var/log/kern.log.
  • KASAN reports flagging use-after-free reads on mlx5_termtbl_handle allocations when running debug kernels.
  • Repeated NIC resets or E-Switch flow offload failures correlating with high flow-rule churn.

Detection Strategies

  • Enable CONFIG_KASAN on test and staging kernels to surface use-after-free conditions in the mlx5 driver during flow-offload stress testing.
  • Compare the running kernel's net/mlx5/eswitch_offloads_termtbl.c against the fixed commits listed in the advisory to confirm whether the patched logic is present.
  • Monitor host telemetry for repeated mlx5_core module crashes or soft lockups on hosts using ConnectX adapters with switchdev mode.

Monitoring Recommendations

  • Centralize kernel ring buffer and journald output and alert on stack traces containing mlx5_eswitch_termtbl symbols.
  • Track kernel package versions across the fleet and flag hosts running mlx5-enabled kernels that predate the fix commits.
  • Correlate NIC-level counter anomalies (TC offload failures, flow eviction spikes) with host stability events to catch exploitation attempts early.

How to Mitigate CVE-2026-98015

Immediate Actions Required

  • Inventory all hosts running Mellanox ConnectX adapters with the mlx5_core driver and E-Switch offload (switchdev mode) enabled.
  • Apply the stable kernel update containing the fix commits as soon as vendor-supported packages are available from your Linux distribution.
  • Restrict local access on affected hosts to trusted administrators until patched, since triggering the race requires the ability to drive concurrent flow-rule operations.

Patch Information

The fix was merged upstream across multiple stable branches. Review the commits for the exact change that moves the cleanup decision inside the termtbl_mutex critical section: Kernel Git Commit 18b2969, Kernel Git Commit 304ea40, Kernel Git Commit 7ee07f6, and Kernel Git Commit e393789. Rebuild and reboot affected hosts after installing the patched kernel package from your distribution.

Workarounds

  • Where possible, disable E-Switch switchdev mode on affected ConnectX adapters until the patched kernel is deployed, reverting to legacy SR-IOV mode that does not exercise the vulnerable termination table path.
  • Reduce flow-rule churn on offload-enabled interfaces to lower the probability of hitting the race window on unpatched systems.
  • Enforce least privilege for workloads capable of programming TC flower or OVS offload rules so that only trusted components can trigger the affected code path.
bash
# Check loaded mlx5 driver and current kernel version
uname -r
modinfo mlx5_core | grep -E '^(version|filename):'

# Identify ConnectX interfaces running in switchdev (E-Switch) mode
for dev in /sys/class/net/*/device; do
  iface=$(basename $(dirname $dev))
  if [ -e "$dev/sriov_numvfs" ]; then
    mode=$(devlink dev eswitch show pci/$(basename $(readlink $dev)) 2>/dev/null)
    echo "$iface: $mode"
  fi
done

# Temporary workaround: revert an adapter from switchdev to legacy mode
# (replace <pci-bdf> with the actual PCI address, e.g. 0000:04:00.0)
devlink dev eswitch set pci/<pci-bdf> mode legacy

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.