linux/Documentation/netlink/specs
Jamal Hadi Salim 1aa9e143bf net: reject oversized tx_queue_len at netlink parse time
rtnl_create_link() assigns IFLA_TXQLEN directly to dev->tx_queue_len
without going through netif_change_tx_queue_len(), so a device created
with "ip link add ... txqueuelen 500000" bypasses the S16_MAX cap and
still triggers the oversized ring allocations in pfifo_fast, tun and
tap. The veth peer nest (rtnl_nla_parse_ifinfomsg()) and the
RTM_NEWLINK-on-existing-device path reach the same sinks.

Enforce the cap in ifla_policy instead: IFLA_TXQLEN becomes
NLA_POLICY_FULL_RANGE(NLA_U32, &txqlen_range) with
txqlen_range = { .min = 0, .max = S16_MAX }. All netlink consumers
parse against this policy - rtnl_setlink(), rtnl_newlink() (create
and change), and the veth peer nest - so every netlink path is capped
at parse time and rejects the attribute with -ERANGE plus a proper
"integer out of range" extack message before any device state is
modified (the RTM_SETLINK half-application wart is gone with it).

Document the bound in the rt-link.yaml netlink spec.

Conditions to recreate the bug:
- CONFIG_NET_SCHED=y, CONFIG_VETH=y, CONFIG_USER_NS=y, CONFIG_NET_NS=y.
- Unprivileged user in a fresh user+net namespace (unshare -Urn):
  ip link add v0 txqueuelen 500000 type veth peer name v1
  -> on the fixed kernel this is rejected with -ERANGE ("integer out
  of range" extack) instead of installing an oversized tx_queue_len
  that later inflates pfifo_fast/tun/tap ring allocations.
- ip link set v0 txqueuelen 500000 is likewise rejected at parse time.

Fixes: 38f7b870d4 ("[RTNETLINK]: Link creation API")
Reported-by: Vega <vega@nebusec.ai>
Tested-by: Victor Nogueira <victor@mojatatu.com>
Signed-off-by: Jamal Hadi Salim <jhs@mojatatu.com>
Link: https://patch.msgid.link/QDISC-2899.v2.20260901233641@mojatatu.com.2
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
History 2026-09-04 16:30:49 -07:00
..
binder.yaml netlink: specs: binder: replace underscores with dashes in names 2025-08-21 16:49:38 +02:00
conntrack.yaml netlink: specs: add missing mask attributes for conntrack dump 2026-08-28 15:34:51 -07:00
dev-energymodel.yaml PM: EM: Add dump to get-perf-domains in the EM YNL spec 2026-01-09 21:44:46 +01:00
devlink.yaml devlink: Allow parent dev for rate-set and rate-new 2026-07-07 11:31:26 +02:00
dpll.yaml dpll: add DPLL_PIN_TYPE_INT_NCO pin type 2026-07-06 14:45:05 +02:00
drm_ras.yaml drm/drm_ras: Add clear-error-counter netlink command to drm_ras 2026-04-24 08:43:42 -04:00
ethtool.yaml net: ethtool: add ethtool COALESCE_RX_CQE_FRAMES/NSECS 2026-03-18 20:01:10 -07:00
fou.yaml fou: Don't allow 0 for FOU_ATTR_IPPROTO. 2026-01-17 16:00:24 -08:00
handshake.yaml handshake: Require admin permission for DONE command 2026-06-12 15:45:44 -07:00
index.rst docs: netlink: index.rst: add a netlink index file 2025-08-12 07:47:30 +02:00
lockd.yaml netlink: specs: clean up spaces in brackets 2025-06-11 14:01:19 -07:00
mptcp_pm.yaml mptcp: fix kdoc warnings 2026-02-06 20:35:06 -08:00
net_shaper.yaml net: shaper: reject handle IDs exceeding internal bit-width 2026-05-12 16:15:00 +02:00
netdev.yaml net: devmem: allow rx-page-size > PAGE_SIZE per dmabuf binding 2026-08-07 18:32:39 -07:00
nfsd.yaml nfsd: export NFSv4 callback op stats via netlink 2026-08-10 09:54:35 -04:00
nftables.yaml doc/netlink: nftables: Fill out operation attributes 2026-03-05 18:49:08 -08:00
nl80211.yaml netlink: specs: nl80211: fix TOOD -> TODO 2026-07-29 16:57:45 -07:00
nlctrl.yaml netlink: specs: clean up spaces in brackets 2025-06-11 14:01:19 -07:00
ovpn.yaml ovpn: limit keepalive values to one day 2026-07-30 11:28:30 +02:00
ovs_datapath.yaml netlink: specs: explicitly declare block scalar strings 2025-09-15 18:27:19 -07:00
ovs_flow.yaml netlink: specs: explicitly declare block scalar strings 2025-09-15 18:27:19 -07:00
ovs_packet.yaml netlink: specs: add OVS packet family specification 2026-05-26 17:17:41 -07:00
ovs_vport.yaml netlink: specs: explicitly declare block scalar strings 2025-09-15 18:27:19 -07:00
psp.yaml psp: add a new netdev event for dev unregister 2026-06-12 18:31:32 -07:00
rt-addr.yaml net: ipv4: report multicast group user count 2026-07-03 08:50:43 +02:00
rt-link.yaml net: reject oversized tx_queue_len at netlink parse time 2026-09-04 16:30:49 -07:00
rt-neigh.yaml netlink: specs: support ipv4-or-v6 for dual-stack fields 2025-11-18 18:42:10 -08:00
rt-route.yaml netlink: specs: rt-route: add the route deletion reason 2026-08-13 12:30:27 +02:00
rt-rule.yaml netlink: specs: support ipv4-or-v6 for dual-stack fields 2025-11-18 18:42:10 -08:00
sunrpc_cache.yaml NFSD: Put cache get-reqs dump attrs under reply 2026-06-01 11:08:18 -04:00
tc.yaml net/sched: sch_cake: share shaper state across sub-instances of cake_mq 2026-01-13 11:54:29 +01:00
tcp_metrics.yaml netlink: specs: clean up spaces in brackets 2025-06-11 14:01:19 -07:00
team.yaml netlink: specs: team: avoid mangling multilines doc 2025-09-15 18:27:19 -07:00
wireguard.yaml wireguard: netlink: add YNL specification 2025-12-02 04:12:19 +01:00