summaryrefslogtreecommitdiff
path: root/include/net
diff options
context:
space:
mode:
authorStanislav Fomichev <sdf@google.com>2024-03-18 19:54:27 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2024-04-10 17:37:53 +0300
commit16e85e1dd0f1ca733ed11712a35f1b6c26711aeb (patch)
tree35ad046178e0b9517d20c94d92a36b1dd9501204 /include/net
parente66f4ab7920aeb263ab72cf71e84bb0fb8c2e333 (diff)
downloadlinux-16e85e1dd0f1ca733ed11712a35f1b6c26711aeb.tar.xz
xsk: Don't assume metadata is always requested in TX completion
[ Upstream commit f6e922365faf4cd576bd1cf3e64b58c8a32e1856 ] `compl->tx_timestam != NULL` means that the user has explicitly requested the metadata via XDP_TX_METADATA+XDP_TX_METADATA_TIMESTAMP. Fixes: 48eb03dd2630 ("xsk: Add TX timestamp and TX checksum offload support") Reported-by: Daniele Salvatore Albano <d.albano@gmail.com> Signed-off-by: Stanislav Fomichev <sdf@google.com> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net> Tested-by: Daniele Salvatore Albano <d.albano@gmail.com> Link: https://lore.kernel.org/bpf/20240318165427.1403313-1-sdf@google.com Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'include/net')
-rw-r--r--include/net/xdp_sock.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/include/net/xdp_sock.h b/include/net/xdp_sock.h
index 3cb4dc9bd70e..3d54de168a6d 100644
--- a/include/net/xdp_sock.h
+++ b/include/net/xdp_sock.h
@@ -188,6 +188,8 @@ static inline void xsk_tx_metadata_complete(struct xsk_tx_metadata_compl *compl,
{
if (!compl)
return;
+ if (!compl->tx_timestamp)
+ return;
*compl->tx_timestamp = ops->tmo_fill_timestamp(priv);
}