Skip to contentSkip to conversation

CVE-2026-80845: xfrm: avoid lock inversion in nat keepalive work

DISCUSSION Greg Kroah-Hartman 1 participant 1 message Sep 4

lore
Share & tools
lore
#0 lore raw

From: Greg Kroah-Hartman <[email protected]>

Description
===========

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

xfrm: avoid lock inversion in nat keepalive work

nat_keepalive_work() walks the state table while xfrm_state_walk() holds net->xfrm.xfrm_state_lock. Its callback then acquires x->lock, which conflicts with the delete path taking the same locks in reverse order via xfrm_state_delete() and __xfrm_state_delete(). This creates an AB-BA deadlock that is reported by lockdep when a NAT keepalive worker races with SA deletion.

Fix this by splitting the keepalive walk into two phases. First, collect the candidate states while the walk holds xfrm_state_lock and take a reference on each state. Then, after the walk completes, process each collected state and acquire x->lock without nesting it under xfrm_state_lock.

The Linux kernel CVE team has assigned CVE-2026-80845 to this issue.

Affected and fixed versions
===========================

	Issue introduced in 6.11 with commit f531d13bdfe3f4f084aaa8acae2cb0f02295f5ae and fixed in 6.12.108 with commit ea09210462316e5235a25eccb11ad0708d86615e
	Issue introduced in 6.11 with commit f531d13bdfe3f4f084aaa8acae2cb0f02295f5ae and fixed in 6.18.49 with commit 5c86c895d1cac81a71ead3005084c6265cf6a7a5
	Issue introduced in 6.11 with commit f531d13bdfe3f4f084aaa8acae2cb0f02295f5ae and fixed in 7.1.13 with commit 89ef3a2e1e4682ab82b0455ce113f8c39fb9e50d
	Issue introduced in 6.11 with commit f531d13bdfe3f4f084aaa8acae2cb0f02295f5ae and fixed in 7.2.3 with commit a9fa05b7a1246797748d15771052639e0d3cabf1
	Issue introduced in 6.11 with commit f531d13bdfe3f4f084aaa8acae2cb0f02295f5ae and fixed in 7.3-rc1 with commit 763fe700b7c58ad64fe5202c5638848244dd4127

Please see https://www.kernel.org for a full list of currently supported kernel versions by the kernel community.

Unaffected versions might change over time as fixes are backported to older supported kernel versions. The official CVE entry at

	https://cve.org/CVERecord/?id=CVE-2026-80845

will be updated if fixes are backported, please check that for the most up to date information about this issue.

Affected files
==============

The file(s) affected by this issue are:
net/xfrm/xfrm_nat_keepalive.c

Mitigation
==========

The Linux kernel CVE team recommends that you update to the latest stable kernel version for this, and many other bugfixes. Individual changes are never tested alone, but rather are part of a larger kernel release. Cherry-picking individual commits is not recommended or supported by the Linux kernel community at all. If however, updating to the latest release is impossible, the individual changes to resolve this issue can be found at these commits:

	https://git.kernel.org/stable/c/ea09210462316e5235a25eccb11ad0708d86615e
	https://git.kernel.org/stable/c/5c86c895d1cac81a71ead3005084c6265cf6a7a5
	https://git.kernel.org/stable/c/89ef3a2e1e4682ab82b0455ce113f8c39fb9e50d
	https://git.kernel.org/stable/c/a9fa05b7a1246797748d15771052639e0d3cabf1
	https://git.kernel.org/stable/c/763fe700b7c58ad64fe5202c5638848244dd4127