net/iavf: fix mbuf leak
authorQiming Chen <chenqiming_huawei@163.com>
Sat, 11 Sep 2021 01:47:09 +0000 (09:47 +0800)
committerQi Zhang <qi.z.zhang@intel.com>
Wed, 15 Sep 2021 01:22:28 +0000 (03:22 +0200)
A local test found that repeated port start and stop operations during
the continuous SSE vector bufflist receiving process will cause the mbuf
resource to run out. The final positioning is when the port is stopped,
the mbuf of the pkt_first_seg pointer is not released. Resources leak.
The patch scheme is to judge whether the pointer is empty when the port
is stopped, and release the corresponding mbuf if it is not empty.

Fixes: 69dd4c3d0898 ("net/avf: enable queue and device")
Cc: stable@dpdk.org
Signed-off-by: Qiming Chen <chenqiming_huawei@163.com>
Acked-by: Qi Zhang <qi.z.zhang@intel.com>
drivers/net/iavf/iavf_rxtx.c

index e33fe45..7240e70 100644 (file)
@@ -225,6 +225,10 @@ reset_rx_queue(struct iavf_rx_queue *rxq)
 
        rxq->rx_tail = 0;
        rxq->nb_rx_hold = 0;
+
+       if (rxq->pkt_first_seg != NULL)
+               rte_pktmbuf_free(rxq->pkt_first_seg);
+
        rxq->pkt_first_seg = NULL;
        rxq->pkt_last_seg = NULL;
        rxq->rxrearm_nb = 0;