CVE-2026-31418: netfilter: ipset: drop logically empty buckets in mtype_del
From: Greg Kroah-Hartman <[email protected]>
Description
===========
In the Linux kernel, the following vulnerability has been resolved:
netfilter: ipset: drop logically empty buckets in mtype_del
mtype_del() counts empty slots below n->pos in k, but it only drops the bucket when both n->pos and k are zero. This misses buckets whose live entries have all been removed while n->pos still points past deleted slots.
Treat a bucket as empty when all positions below n->pos are unused and release it directly instead of shrinking it further.
The Linux kernel CVE team has assigned CVE-2026-31418 to this issue.
Affected and fixed versions
===========================
Issue introduced in 5.6 with commit 8af1c6fbd9239877998c7f5a591cb2c88d41fb66 and fixed in 6.1.168 with commit ad92ee87462f9a3061361d392e9dbfe2e5c1c9fb Issue introduced in 5.6 with commit 8af1c6fbd9239877998c7f5a591cb2c88d41fb66 and fixed in 6.6.134 with commit 6cea34d7ec6829b62f521a37a287f670144a2233 Issue introduced in 5.6 with commit 8af1c6fbd9239877998c7f5a591cb2c88d41fb66 and fixed in 6.12.81 with commit b7eef00f08b92b0b9efe8ae0df6d0005e6199323 Issue introduced in 5.6 with commit 8af1c6fbd9239877998c7f5a591cb2c88d41fb66 and fixed in 6.18.22 with commit 68ca0eea0af02bed36c5e2c13e9fa1647c31a7d4 Issue introduced in 5.6 with commit 8af1c6fbd9239877998c7f5a591cb2c88d41fb66 and fixed in 6.19.12 with commit ceacaa76f221a6577aba945bb8873c2e640aeba4 Issue introduced in 5.6 with commit 8af1c6fbd9239877998c7f5a591cb2c88d41fb66 and fixed in 7.0 with commit 9862ef9ab0a116c6dca98842aab7de13a252ae02 Issue introduced in 5.4.24 with commit 6c717726f341fd8f39a3ec2dcf5d98d9d28a2769 Issue introduced in 5.5.8 with commit d2997d64dfa65082236bca1efd596b6c935daf5e
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-31418
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/ipset/ip_set_hash_gen.h
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/ad92ee87462f9a3061361d392e9dbfe2e5c1c9fb https://git.kernel.org/stable/c/6cea34d7ec6829b62f521a37a287f670144a2233 https://git.kernel.org/stable/c/b7eef00f08b92b0b9efe8ae0df6d0005e6199323 https://git.kernel.org/stable/c/68ca0eea0af02bed36c5e2c13e9fa1647c31a7d4 https://git.kernel.org/stable/c/ceacaa76f221a6577aba945bb8873c2e640aeba4 https://git.kernel.org/stable/c/9862ef9ab0a116c6dca98842aab7de13a252ae02