Skip to contentSkip to conversation

net/mlx5e: Fix AF_XDP TX timestamp teardown NULL dereference

PATCH Applied [email protected] 3 participants 3 messages Sep 26 – Oct 1

Subsystems (5)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net/mlx5e: Fix AF_XDP TX timestamp teardown NULL dereference

From: Prathamesh Deshpande <[email protected]>

During XSK TX queue teardown, outstanding descriptors are completed without a CQE. If one requested a TX timestamp, the completion path passes that NULL CQE to mlx5e_xsk_fill_timestamp(), which dereferences it.

Return zero when no CQE is available, indicating that teardown did not produce a TX timestamp.

Fixes ec706a860eba ("net/mlx5e: Implement AF_XDP TX timestamp and checksum offload")
---
 drivers/net/ethernet/mellanox/mlx5/core/en/xdp.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/net/ethernet/mellanox/mlx5/core/en/xdp.c +3 -0
index 77ea51bfbaae..2cca20e1b9b7 100644
@@ -293,6 +293,9 @@ static u64 mlx5e_xsk_fill_timestamp(void *_priv)
 	struct mlx5e_xsk_tx_complete *priv = _priv;
 	u64 ts;
 
+	if (!priv->cqe)
+		return 0;
+
 	ts = get_cqe_ts(priv->cqe);
 
 	if (mlx5_is_real_time_rq(priv->cq->mdev) || mlx5_is_real_time_sq(priv->cq->mdev))
Signature · 1 line
2.43.0
maintainer Reviewed-by on v1 1/1
#1 lore raw
Quoted 22 lines · On 26/09/2026 19:53, [email protected] wrote:

From: Prathamesh Deshpande <[email protected]>

During XSK TX queue teardown, outstanding descriptors are completed without a CQE. If one requested a TX timestamp, the completion path passes that NULL CQE to mlx5e_xsk_fill_timestamp(), which dereferences it.

Return zero when no CQE is available, indicating that teardown did not produce a TX timestamp.

Fixes ec706a860eba ("net/mlx5e: Implement AF_XDP TX timestamp and checksum offload")
---
  drivers/net/ethernet/mellanox/mlx5/core/en/xdp.c | 3 +++
  1 file changed, 3 insertions(+)
drivers/net/ethernet/mellanox/mlx5/core/en/xdp.c +0 -0
index 77ea51bfbaae..2cca20e1b9b7 100644

drivers/net/ethernet/mellanox/mlx5/core/en/xdp.c static u64 mlx5e_xsk_fill_timestamp(void *_priv) · line 301

Quoted 9 lines
drivers/net/ethernet/mellanox/mlx5/core/en/xdp.c +3 -0
@@ -293,6 +293,9 @@ static u64 mlx5e_xsk_fill_timestamp(void *_priv)
  	struct mlx5e_xsk_tx_complete *priv = _priv;
  	u64 ts;
 
+	if (!priv->cqe)
+		return 0;
+
  	ts = get_cqe_ts(priv->cqe);
 
  	if (mlx5_is_real_time_rq(priv->cq->mdev) || mlx5_is_real_time_sq(priv->cq->mdev))

Thanks.

#2 lore raw
In reply to [email protected]
This patch was applied to netdev/net.git (main) by Jakub Kicinski <[email protected]>:

Hello:

This patch was applied to netdev/net.git (main)
by Jakub Kicinski <[email protected]>:

Quoted 8 lines · On Sat, 26 Sep 2026 17:53:57 +0100 you wrote:

From: Prathamesh Deshpande <[email protected]>

During XSK TX queue teardown, outstanding descriptors are completed without a CQE. If one requested a TX timestamp, the completion path passes that NULL CQE to mlx5e_xsk_fill_timestamp(), which dereferences it.

[...]

Here is the summary with links:
- [net] net/mlx5e: Fix AF_XDP TX timestamp teardown NULL dereference

    https://git.kernel.org/netdev/net/c/7b97273cbebe

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html