* [RFT] net/mlx5: fix out-of-bounds stride index in vector Rx
@ 2026-10-12 16:34 Stephen Hemminger
0 siblings, 0 replies; only message in thread
From: Stephen Hemminger @ 2026-10-12 16:34 UTC (permalink / raw)
To: dev
Cc: Stephen Hemminger, stable, Kamil Vojanec, Dariusz Sosnowski,
Viacheslav Ovsiienko, Bing Zhao, Ori Kam, Suanming Mou,
Matan Azrad, Alexander Kozyrev
The vectorized MPRQ path uses the software counter consumed_strd as the
stride index, resetting it only when it equals strd_n. The per-packet
stride count comes from pkt_len, which may not match the strides the
device consumed, so under load consumed_strd can drift past strd_n. The
stale index then makes mprq_buf_to_pkt() read buf->shinfos[] and the
stride offset out of bounds, corrupting mbuf metadata or accessing past
the buffer.
Drop the packet and realign to the next WQE when the stride index would
leave the buffer.
Bugzilla ID: 1369
Fixes: 0f20acbf5eda ("net/mlx5: implement vectorized MPRQ burst")
Cc: stable@dpdk.org
Reported-by: Kamil Vojanec <vojanec@cesnet.cz>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
This patch looks right, it was generated by Claude based on
the bug report. I don't have mlx5 or any way to reproduce
original problem.
drivers/net/mlx5/mlx5_rxtx_vec.c | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/drivers/net/mlx5/mlx5_rxtx_vec.c b/drivers/net/mlx5/mlx5_rxtx_vec.c
index 79e92811d5..eebce160fd 100644
--- a/drivers/net/mlx5/mlx5_rxtx_vec.c
+++ b/drivers/net/mlx5/mlx5_rxtx_vec.c
@@ -232,6 +232,20 @@ rxq_copy_mprq_mbuf_v(struct mlx5_rxq_data *rxq,
}
strd_cnt = (elts[i]->pkt_len / strd_sz) +
((elts[i]->pkt_len % strd_sz) ? 1 : 0);
+ /* Drop and realign if the stride index drifted past the
+ * buffer, rather than letting mprq_buf_to_pkt() index
+ * past shinfos[] and the stride region (bug 1369).
+ */
+ if (unlikely(rxq->consumed_strd + strd_cnt > strd_n)) {
+ rxq->consumed_strd = strd_n;
+ rte_pktmbuf_free_seg(elts[i]);
+#ifdef MLX5_PMD_SOFT_COUNTERS
+ rxq->stats.ipackets -= 1;
+ rxq->stats.ibytes -= elts[i]->pkt_len;
+#endif
+ ++rxq->stats.idropped;
+ continue;
+ }
rxq_code = mprq_buf_to_pkt(rxq, elts[i], elts[i]->pkt_len,
buf, rxq->consumed_strd, strd_cnt);
rxq->consumed_strd += strd_cnt;
--
2.53.0
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2026-10-12 16:35 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-12 16:34 [RFT] net/mlx5: fix out-of-bounds stride index in vector Rx Stephen Hemminger
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox