Skip to contentSkip to conversation

CVE-2025-40018: ipvs: Defer ip_vs_ftp unregister during netns cleanup

DISCUSSION Greg Kroah-Hartman 1 participant 1 message Oct 24, 2025

lore
Share & tools
lore
#0 lore raw

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

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

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

ipvs: Defer ip_vs_ftp unregister during netns cleanup

On the netns cleanup path, __ip_vs_ftp_exit() may unregister ip_vs_ftp before connections with valid cp->app pointers are flushed, leading to a use-after-free.

Fix this by introducing a global exiting_module flag, set to true in ip_vs_ftp_exit() before unregistering the pernet subsystem. In __ip_vs_ftp_exit(), skip ip_vs_ftp unregister if called during netns cleanup (when exiting_module is false) and defer it to __ip_vs_cleanup_batch(), which unregisters all apps after all connections are flushed. If called during module exit, unregister ip_vs_ftp immediately.

The Linux kernel CVE team has assigned CVE-2025-40018 to this issue.

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

	Issue introduced in 2.6.39 with commit 61b1ab4583e275af216c8454b9256de680499b19 and fixed in 5.15.195 with commit 1d79471414d7b9424d699afff2aa79fff322f52d
	Issue introduced in 2.6.39 with commit 61b1ab4583e275af216c8454b9256de680499b19 and fixed in 6.1.156 with commit 53717f8a4347b78eac6488072ad8e5adbaff38d9
	Issue introduced in 2.6.39 with commit 61b1ab4583e275af216c8454b9256de680499b19 and fixed in 6.6.112 with commit 8cbe2a21d85727b66d7c591fd5d83df0d8c4f757
	Issue introduced in 2.6.39 with commit 61b1ab4583e275af216c8454b9256de680499b19 and fixed in 6.12.53 with commit dc1a481359a72ee7e548f1f5da671282a7c13b8f
	Issue introduced in 2.6.39 with commit 61b1ab4583e275af216c8454b9256de680499b19 and fixed in 6.17.3 with commit a343811ef138a265407167294275201621e9ebb2
	Issue introduced in 2.6.39 with commit 61b1ab4583e275af216c8454b9256de680499b19 and fixed in 6.18-rc1 with commit 134121bfd99a06d44ef5ba15a9beb075297c0821

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-2025-40018

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/netfilter/ipvs/ip_vs_ftp.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/1d79471414d7b9424d699afff2aa79fff322f52d
	https://git.kernel.org/stable/c/53717f8a4347b78eac6488072ad8e5adbaff38d9
	https://git.kernel.org/stable/c/8cbe2a21d85727b66d7c591fd5d83df0d8c4f757
	https://git.kernel.org/stable/c/dc1a481359a72ee7e548f1f5da671282a7c13b8f
	https://git.kernel.org/stable/c/a343811ef138a265407167294275201621e9ebb2
	https://git.kernel.org/stable/c/134121bfd99a06d44ef5ba15a9beb075297c0821