From: Bruce Richardson Date: Tue, 23 Sep 2014 11:08:13 +0000 (+0100) Subject: mbuf: ensure next pointer is set to null on free X-Git-Tag: spdx-start~10329 X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=7f78e6770144b2e3d485389c4c40d37e75270fb4;p=dpdk.git mbuf: ensure next pointer is set to null on free The receive functions for packets do not modify the next pointer so the next pointer should always be cleared on mbuf free, just in case. The slow-path TX needs to clear it, and the standard mbuf free function also needs to clear it. Fast path TX does not handle chained mbufs so is unaffected Signed-off-by: Bruce Richardson Acked-by: Pablo de Lara --- diff --git a/lib/librte_mbuf/rte_mbuf.h b/lib/librte_mbuf/rte_mbuf.h index 1c6e11507a..8e27d2eedb 100644 --- a/lib/librte_mbuf/rte_mbuf.h +++ b/lib/librte_mbuf/rte_mbuf.h @@ -682,8 +682,10 @@ __rte_pktmbuf_prefree_seg(struct rte_mbuf *m) static inline void __attribute__((always_inline)) rte_pktmbuf_free_seg(struct rte_mbuf *m) { - if (likely(NULL != (m = __rte_pktmbuf_prefree_seg(m)))) + if (likely(NULL != (m = __rte_pktmbuf_prefree_seg(m)))) { + m->next = NULL; __rte_mbuf_raw_free(m); + } } /** diff --git a/lib/librte_pmd_ixgbe/ixgbe_rxtx.c b/lib/librte_pmd_ixgbe/ixgbe_rxtx.c index 9a664c3ca5..d34588576b 100644 --- a/lib/librte_pmd_ixgbe/ixgbe_rxtx.c +++ b/lib/librte_pmd_ixgbe/ixgbe_rxtx.c @@ -145,6 +145,7 @@ ixgbe_tx_free_bufs(struct igb_tx_queue *txq) /* free buffers one at a time */ if ((txq->txq_flags & (uint32_t)ETH_TXQ_FLAGS_NOREFCOUNT) != 0) { for (i = 0; i < txq->tx_rs_thresh; ++i, ++txep) { + txep->mbuf->next = NULL; rte_mempool_put(txep->mbuf->pool, txep->mbuf); txep->mbuf = NULL; }