[PATCH] gro: fix returned packet count after UDP fragment merge
Andrey Mokrushin
a.mokrushin at ideco.ru
Fri Nov 6 08:46:40 CET 2026
rte_gro_reassemble_burst() decrements nb_after_gro only for packets that
are merged while being inserted into the reassembly tables. When the
tables are flushed at the end of the burst, gro_udp4_tbl_timeout_flush()
and gro_vxlan_udp4_tbl_timeout_flush() call gro_udp4_merge_items(), which
merges fragments that became adjacent only after an intermediate fragment
arrived. Such merges are not reflected in nb_after_gro, but they are
accounted for in the local index i, which after the flush holds the
actual number of packets written to pkts[].
The function returns nb_after_gro regardless. When a flush-time merge
happens, the caller is told there are more packets than were actually
produced: the surplus pkts[] entries point to mbufs that are already
chained into an earlier packet. Freeing the returned burst then frees
those mbufs twice and corrupts the mempool, and the surplus entry, whose
headers have been stripped by the merge, is handed back to the caller as
a standalone packet built from fragment payload.
Return the actual packet count i instead. In the path where the flush
block is skipped, i equals nb_pkts, which also equals nb_after_gro, so
the non-merging case is unchanged.
Fixes: 1ca5e6740852 ("gro: support UDP/IPv4")
Cc: stable at dpdk.org
Signed-off-by: Andrey Mokrushin <a.mokrushin at ideco.ru>
---
lib/gro/rte_gro.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/gro/rte_gro.c b/lib/gro/rte_gro.c
index 578cc9b..168960b 100644
--- a/lib/gro/rte_gro.c
+++ b/lib/gro/rte_gro.c
@@ -349,7 +349,7 @@ rte_gro_reassemble_burst(struct rte_mbuf **pkts,
}
}
- return nb_after_gro;
+ return i;
}
RTE_EXPORT_SYMBOL(rte_gro_reassemble)
--
2.56.0
More information about the stable
mailing list