[PATCH] net/mlx5: fix mbuf corruption in vectorized MPRQ Rx
Dariusz Sosnowski
dsosnowski at nvidia.com
Thu Nov 26 16:42:42 CET 2026
On Thu, Nov 26, 2026 at 04:28:24PM +0200, Gavin Hu wrote:
> rxq_burst_mprq_v() caps the packets it handles by the number of
> replenished mbufs:
>
> pkts_n = RTE_MIN(pkts_n, rxq->elts_ci - rxq->rq_pi);
>
> That cap bounds rxq_cq_process_v() and the mbufs returned to the
> application, but not the compressed CQE session handled at the
> "decompress" label. rxq_cq_decompress_v() takes the session length
> from the title CQE and always writes all of it into elts[].
>
> For SPRQ this cannot overrun: the elts mbufs are the buffers posted to
> the RQ, so the HW never completes more packets than there are mbufs.
> MPRQ posts strides instead. The HW keeps completing packets no matter
> how many elts the SW managed to replenish, so the session length is
> unrelated to the number of available elts.
>
> Once the mbuf pool runs dry, unzipping therefore walks past the
> MLX5_VPMD_DESCS_PER_LOOP fake_mbuf guards placed at elts_ci and reaches
> the slots beyond them, which still hold mbufs already handed to the
> application. It overwrites their rearm_data and rx_descriptor_fields1.
> rearm_data covers ol_flags, so the victim loses RTE_MBUF_F_EXTERNAL
> while buf_addr and shinfo keep pointing at the MPRQ stride: the mbuf
> now claims to be direct, but its buffer lives in stride memory. The lost
> RTE_MBUF_F_EXTERNAL flag triggers incorrect mbuf handling later in the
> application, when the mbuf is attached to another one.
>
> Compute the session length from the title CQE before unzipping, the
> same way rxq_cq_decompress_v() does, and leave the session in the CQ
> until it fits entirely in the available elts. The CQ consumer index is
> not advanced, so the session is retried on a later burst once
> replenishment succeeds.
>
> Fixes: 0f20acbf5eda ("net/mlx5: implement vectorized MPRQ burst")
> Cc: stable at dpdk.org
>
> Signed-off-by: Gavin Hu <gahu at nvidia.com>
Acked-by: Dariusz Sosnowski <dsosnowski at nvidia.com>
More information about the stable
mailing list