CVE-2026-98022: net: cap tx_queue_len at S16_MAX to prevent oversized ring allocations
In the Linux kernel, the following vulnerability has been resolved:
net: cap txqueuelen at S16MAX to prevent oversized ring allocations
Several subsystems allocate ring buffers sized by dev->txqueuelen with no upper bound. An unprivileged user (via unshare -Urn) can set a huge txqueuelen and exhaust global memory with ring allocations:
- pfifofast: pfifofastinit() and pfifofastchangetxqueuelen() allocate 3 skbarray rings of txqueuelen entries each. - tun: tunqueueresize() and the queue-attach path resize ptrrings to txqueuelen on the NETDEVCHANGETXQUEUELEN notifier. - tap (macvtap/ipvtap): tapqueueresize() and tapinit() resize/init ptrrings to txqueuelen on the same notifier.
netifchangetxqueuelen() is the single entry point for IFLATXQLEN, sysfs, and the SIOCSIFTXQLEN ioctl. Cap newlen at S16MAX (32767) there so the oversized value is rejected at set time. This takes effect whether the device is up or down, before dev->txqueuelen is written, before any notifier fires, and before any ring is allocated. The "> S16MAX" check also subsumes the previous unsigned-long truncation test, and a negative ifrqlen from the ioctl lands far above the cap after conversion, so both old failure modes are covered by the one comparison.
txqueuelen is ambigious: both a per-ring sizing multiplier and a default queue-length/limit knob for consumers that allocate nothing at set time (pfifo/bfifo/gred/plug/sfb limits, htb directqlen, qfq maxclasses, teql). 32767 is chosen as the largest value NLAPOLICYFULLRANGE can express for the u32 IFLATXQLEN policy in patch 2/3 while staying a legitimate queue length on high-BDP paths; the ring-memory trade-off of a shared knob is disclosed below.
Conditions to recreate the bug: - CONFIGNETSCHED=y, CONFIGVETH=y, CONFIGUSERNS=y, CONFIGNETNS=y. - Unprivileged user in a fresh user+net namespace (unshare -Urn). - pfifofast: create veth pairs, set txqueuelen to 500000, attach mq+pfifofast. ~28 iterations OOMs a 2GB guest. - tun: create 50 tun devices with IFFMULTIQUEUE, set txqueuelen to 500000, open 8 queues each. ~1.6GB of ptrring allocations OOMs a 512MB guest. - tap: same as tun with IFFTAP. ~960MB OOMs a 512MB guest. - On the fixed kernel the oversized txqueuelen is rejected with -ERANGE at set time (all four paths: RTMSETLINK, RTMNEWLINK create, sysfs, ioctl - the latter two via this check, the former two via this check and the 2/3 parse policy respectively).
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Configuration
Cap tx_queue_len at S16_MAX (32767); reject values above 32767 with ERANGE before allocating ring buffers.
Linux kernel network devices tx_queue_len = 32767
Event History
Frequently Asked Questions
What level of access does an attacker need?
An unprivileged user can trigger the issue by using unshare -Urn to create a user and network namespace, then setting an excessively large transmit queue length.
Which networking components can allocate excessive memory?
The affected ring allocations are in pfifo_fast, tun, and tap implementations including macvtap and ipvtap. These components size skb_array or ptr_ring buffers from the device transmit queue length.
Is an interface protected by being down when its queue length is changed?
No. The queue-length limit is applied whether the device is up or down, before the new value is written and before notifiers or ring allocations occur.
How can an administrator check whether the fix is present?
Attempting to set a transmit queue length above 32767 through IFLA_TXQLEN, sysfs, or the SIOCSIFTXQLEN ioctl should be rejected at set time. A kernel that accepts such a value does not exhibit the described capped behavior.