In gve_free_bulk_mbuf(), the initial scan for the first segment ready
to return to its mempool calls rte_pktmbuf_prefree_seg(txep[s]) without
clearing txep[s]. Neither the early scan (including refcounted segments
where prefree returns NULL) nor the subsequent loop starting at s + 1
resets txep[s] to NULL, leaving stale mbuf pointers in sw_ring that
gve_release_txq_mbufs() frees a second time on queue stop or release.
Clear txep[s] immediately after rte_pktmbuf_prefree_seg(), matching the
cleanup loop for the remaining entries.
Fixes: a46583cf43c8 ("net/gve: support Rx/Tx")
Cc: [email protected]
Signed-off-by: Ryan Wolfe <[email protected]>
---
drivers/net/gve/gve_tx.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/net/gve/gve_tx.c b/drivers/net/gve/gve_tx.c
index 279669165f..d344648d0f 100644
--- a/drivers/net/gve/gve_tx.c
+++ b/drivers/net/gve/gve_tx.c
@@ -19,6 +19,7 @@ gve_free_bulk_mbuf(struct rte_mbuf **txep, int num)
for (s = 0; s < num; s++) {
if (txep[s] != NULL) {
m = rte_pktmbuf_prefree_seg(txep[s]);
+ txep[s] = NULL;
if (m != NULL)
break;
}