CVE-2026-31516 xfrm: prevent policy_hthresh.work from racing with netns teardown

High 7.8 Published Updated

A race condition in the Linux kernel XFRM subsystem allows use-after-free of network namespace structures, potentially leading to code execution or denial of service.

Exploited in the wild
Not known
Login needed
Any signed-in user
Attackable
Local or same network only
Victim action needed
Not needed
Fix
Available

What is CVE-2026-31516?

CVE-2026-31516 is a high-severity vulnerability in Linux kernel, published on 22 Apr 2026. It can only be exploited from the same machine or local network, with no action from the victim.

Official description

In the Linux kernel, the following vulnerability has been resolved:

xfrm: prevent policy_hthresh.work from racing with netns teardown

A XFRM_MSG_NEWSPDINFO request can queue the per-net work item policy_hthresh.work onto the system workqueue.

The queued callback, xfrm_hash_rebuild(), retrieves the enclosing struct net via container_of(). If the net namespace is torn down before that work runs, the associated struct net may already have been freed, and xfrm_hash_rebuild() may then dereference stale memory.

xfrm_policy_fini() already flushes policy_hash_work during teardown, but it does not synchronize policy_hthresh.work.

Synchronize policy_hthresh.work in xfrm_policy_fini() as well, so the queued work cannot outlive the net namespace teardown and access a freed struct net.

Weakness: CWE-362, CWE-416

Which versions are affected by CVE-2026-31516?

It affects 1 product.

Products include Linux kernel.

How do I fix CVE-2026-31516?

Apply the vendor's patch.

Is CVE-2026-31516 being exploited?

There is no known exploitation of CVE-2026-31516 in the wild and no public exploit code.

All Linux kernel vulnerabilities

Sources

Also known as AZL-83213, BELL-CVE-2026-31516, DEBIAN-CVE-2026-31516, GHSA-g967-c7qh-8q49, ROOT-OS-DEBIAN-11-CVE-2026-31516, ROOT-OS-DEBIAN-12-CVE-2026-31516 and 4 more.

Is CVE-2026-31516 in your software?

Upload an SBOM and sbomify checks it against every vulnerability here, every day.

Check your SBOMs for free