mirror-linux/drivers/net
Jesper Dangaard Brouer 08f566e8f8 veth: fix OOB txq access in veth_poll() with asymmetric queue counts
XDP redirect into a veth device (via bpf_redirect()) calls
veth_xdp_xmit(), which enqueues frames into the peer's ptr_ring using
  smp_processor_id() % peer->real_num_rx_queues
as the ring index.  With an asymmetric veth pair where the peer has
fewer TX queues than RX queues, that index can exceed
peer->real_num_tx_queues.

veth_poll() then resolves peer_txq for the ring via:

  peer_txq = peer_dev ? netdev_get_tx_queue(peer_dev, queue_idx) : NULL;

where queue_idx = rq->xdp_rxq.queue_index.  When queue_idx exceeds
peer_dev->real_num_tx_queues this is an out-of-bounds (OOB) access
into the peer's netdev_queue array, triggering DEBUG_NET_WARN_ON_ONCE
in netdev_get_tx_queue().

The normal ndo_start_xmit path is not affected: the stack clamps
skb->queue_mapping via netdev_cap_txqueue() before invoking
ndo_start_xmit, so rxq in veth_xmit() never exceeds real_num_tx_queues.

Fix veth_poll() by clamping: only dereference peer_txq when queue_idx is
within bounds, otherwise set it to NULL.  The out-of-range rings are fed
exclusively via XDP redirect (veth_xdp_xmit), never via ndo_start_xmit
(veth_xmit), so the peer txq was never stopped and there is nothing to
wake; NULL is the correct fallback.

Reported-by: Sashiko <sashiko-bot@kernel.org>
Closes: https://lore.kernel.org/all/20260502071828.616C3C19425@smtp.kernel.org/
Fixes: dc82a33297 ("veth: apply qdisc backpressure on full ptr_ring to reduce TX drops")
Signed-off-by: Jesper Dangaard Brouer <hawk@kernel.org>
Link: https://patch.msgid.link/20260505132159.241305-2-hawk@kernel.org
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
2026-05-07 16:24:07 +02:00
..
arcnet
bonding bonding: 3ad: implement proper RCU rules for port->aggregator 2026-04-29 18:32:02 -07:00
can Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2026-04-14 12:04:00 -07:00
dsa net: dsa: mt7530: fix .get_stats64 sleeping in atomic context 2026-05-04 19:28:54 -07:00
ethernet eth: fbnic: fix double-free of PCS on phylink creation failure 2026-05-07 12:34:42 +02:00
fddi
fjes
hyperv
ieee802154
ipa Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2026-04-14 12:04:00 -07:00
ipvlan Networking changes for 7.1. 2026-04-14 18:36:10 -07:00
mctp net: mctp i2c: check length before marking flow active 2026-04-28 13:11:53 +02:00
mdio net: mdio: MDIO_PIC64HPSC should depend on ARCH_MICROCHIP 2026-04-16 19:04:58 -07:00
netdevsim netdevsim: psp: rcu protect psp_dev reference 2026-05-06 17:39:20 -07:00
ovpn ovpn: ensure packet delivery happens with BH disabled 2026-05-05 00:31:06 +02:00
pcs
phy net: phy: micrel: fix LAN8814 QSGMII soft reset 2026-04-30 16:49:23 -07:00
plip
ppp pppoe: drop PFC frames 2026-04-20 11:35:17 -07:00
pse-pd net: pse-pd: fix out-of-bounds bitmap access in pse_isr() on 32-bit 2026-04-16 19:25:32 -07:00
slip slip: bound decode() reads against the compressed packet length 2026-04-21 10:18:18 +02:00
team net: team: Add new tx_enabled team port option 2026-04-13 15:09:49 +02:00
thunderbolt
usb net: usb: asix: ax88772: re-add usbnet_link_change() in phylink callbacks 2026-05-04 19:04:15 -07:00
vmxnet3
vxlan
wan net: wan: fsl_ucc_hdlc: fix ucc_hdlc_remove 2026-05-02 10:14:06 -07:00
wireguard wireguard: device: use exit_rtnl callback instead of manual rtnl_lock in pre_exit 2026-04-14 11:48:04 -07:00
wireless ath.git update for v7.1-rc3 2026-05-05 17:52:48 +02:00
wwan net: wwan: t7xx: validate port_count against message length in t7xx_port_enum_msg_handler 2026-05-05 19:05:11 -07:00
xen-netback
Kconfig caif: remove CAIF NETWORK LAYER 2026-04-23 10:23:44 -07:00
LICENSE.SRC
Makefile net: remove ax25 and amateur radio (hamradio) subsystem 2026-04-23 10:24:02 -07:00
Space.c drivers: net: 8390: wd80x3: Remove this driver 2026-04-23 15:57:10 -07:00
amt.c
bareudp.c bareudp: fix NULL pointer dereference in bareudp_fill_metadata_dst() 2026-04-28 18:16:53 -07:00
dummy.c dummy: convert to ndo_set_rx_mode_async 2026-04-21 12:50:25 +02:00
eql.c
geneve.c
gtp.c gtp: disable BH before calling udp_tunnel_xmit_skb() 2026-04-20 11:46:24 -07:00
ifb.c
loopback.c
macsec.c macsec: Support VLAN-filtering lower devices 2026-04-09 19:38:42 -07:00
macvlan.c macvlan: fix macvlan_get_size() not reserving space for IFLA_MACVLAN_BC_CUTOFF 2026-04-16 12:17:11 +02:00
macvtap.c kernfs: pass struct ns_common instead of const void * for namespace tags 2026-04-09 14:36:52 +02:00
mdio.c
mhi_net.c
mii.c
net_failover.c
netconsole.c netconsole: restore userdatum value on update_userdata() failure 2026-04-28 18:28:12 -07:00
netkit.c netkit: convert to ndo_set_rx_mode_async 2026-04-21 12:50:25 +02:00
nlmon.c
ntb_netdev.c
pfcp.c
rionet.c
sungem_phy.c
tap.c
tun.c net: change sk_filter_reason() to return the reason by value 2026-04-12 14:30:25 -07:00
tun_vnet.h
veth.c veth: fix OOB txq access in veth_poll() with asymmetric queue counts 2026-05-07 16:24:07 +02:00
virtio_net.c virtio_net: sync rss_trailer.max_tx_vq on queue_pairs change via VQ_PAIRS_SET 2026-04-23 09:35:53 -07:00
vrf.c vrf: Fix a potential NPD when removing a port from a VRF 2026-04-27 17:43:22 -07:00
vsockmon.c
xen-netfront.c