xsk: Validate xsk_tx_metadata flags
authorStanislav Fomichev <sdf@google.com>
Mon, 27 Nov 2023 19:03:13 +0000 (11:03 -0800)
committerAlexei Starovoitov <ast@kernel.org>
Wed, 29 Nov 2023 22:59:40 +0000 (14:59 -0800)
commitce59f9686e0eca19431571c7403394a6c36371e2
tree0cc41665be78edc0bc31892f88179d322217b078
parent9620e956d5b592d305728144931e89d780a598aa
xsk: Validate xsk_tx_metadata flags

Accept only the flags that the kernel knows about to make
sure we can extend this field in the future. Note that only
in XDP_COPY mode we propagate the error signal back to the user
(via sendmsg). For zerocopy mode we silently skip the metadata
for the descriptors that have wrong flags (since we process
the descriptors deep in the driver).

Signed-off-by: Stanislav Fomichev <sdf@google.com>
Link: https://lore.kernel.org/r/20231127190319.1190813-8-sdf@google.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
include/net/xdp_sock_drv.h
net/xdp/xsk.c