net/mlx5: fix crash in Rx
authorNélio Laranjeiro <nelio.laranjeiro@6wind.com>
Fri, 8 Jul 2016 12:43:26 +0000 (14:43 +0200)
committerBruce Richardson <bruce.richardson@intel.com>
Fri, 8 Jul 2016 20:51:10 +0000 (22:51 +0200)
Fixed issue could occur when Mbuf starvation happens in a middle of
reception of a segmented packet. In such a situation, the PMD has to
release all segments of that packet.  The end condition was wrong
causing it to free an Mbuf still handled by the NIC.

Fixes: 9964b965ad69 ("net/mlx5: re-add Rx scatter support")

Reported-by: Yongseok Koh <yskoh@mellanox.com>
Signed-off-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
Acked-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
drivers/net/mlx5/mlx5_rxtx.c

index 4132fd7..615de94 100644 (file)
@@ -1572,7 +1572,8 @@ mlx5_rx_burst(void *dpdk_rxq, struct rte_mbuf **pkts, uint16_t pkts_n)
                rte_prefetch0(wqe);
                rep = rte_mbuf_raw_alloc(rxq->mp);
                if (unlikely(rep == NULL)) {
-                       while (pkt) {
+                       while (pkt != seg) {
+                               assert(pkt != (*rxq->elts)[idx]);
                                seg = NEXT(pkt);
                                rte_mbuf_refcnt_set(pkt, 0);
                                __rte_mbuf_raw_free(pkt);