]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
xsk: validate metadata when processing requests
authorStanislav Fomichev <sdf.kernel@gmail.com>
Mon, 27 Jul 2026 16:19:59 +0000 (09:19 -0700)
committerJakub Kicinski <kuba@kernel.org>
Mon, 3 Aug 2026 23:43:54 +0000 (16:43 -0700)
commit849b1664dbda1cf6c63e0fd4f9dec23782b8c851
tree570c3ba37fe1fe96599ad74875129479dfb741e6
parentddd0d6c5bfe2fef7c7cf31f62265f29b7b9eb9ef
xsk: validate metadata when processing requests

The zero-copy path validates TX metadata while obtaining the descriptor
context, then reads it again later when preparing the hardware request.
User space can change the metadata between those operations and bypass the
original validation.

Validate the metadata in xsk_tx_metadata_request() and use the resulting
flags snapshot for every feature check. Read request fields once so all
zero-copy drivers process only values observed after successful
validation.

Fixes: ca4419f15abd ("xsk: Add launch time hardware offload support to XDP Tx metadata")
Cc: Cen Zhang (Microsoft) <blbllhy@gmail.com>
Signed-off-by: Stanislav Fomichev <sdf@fomichev.me>
Link: https://patch.msgid.link/20260727161959.885642-7-sdf@fomichev.me
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/intel/igc/igc_main.c
drivers/net/ethernet/mellanox/mlx5/core/en/xdp.c
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
include/net/libeth/xsk.h
include/net/xdp_sock_drv.h
net/xdp/xsk_buff_pool.c