net/iavf: fix mbuf leak

Message ID 20210911014709.2518-1-chenqiming_huawei@163.com (mailing list archive)
State Accepted, archived
Delegated to: Qi Zhang
Headers
Series net/iavf: fix mbuf leak |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/github-robot: build success github build: passed
ci/iol-x86_64-unit-testing fail Testing issues
ci/iol-x86_64-compile-testing success Testing PASS
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-aarch64-compile-testing success Testing PASS
ci/Intel-compilation success Compilation OK
ci/intel-Testing fail Testing issues
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-intel-Performance success Performance Testing PASS

Commit Message

Qiming Chen Sept. 11, 2021, 1:47 a.m. UTC
  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>
---
 drivers/net/iavf/iavf_rxtx.c | 4 ++++
 1 file changed, 4 insertions(+)
  

Comments

Qi Zhang Sept. 15, 2021, 1:20 a.m. UTC | #1
> -----Original Message-----
> From: dev <dev-bounces@dpdk.org> On Behalf Of Qiming Chen
> Sent: Saturday, September 11, 2021 9:47 AM
> To: dev@dpdk.org
> Cc: Xing, Beilei <beilei.xing@intel.com>; Wu, Jingjing <jingjing.wu@intel.com>;
> Qiming Chen <chenqiming_huawei@163.com>; stable@dpdk.org
> Subject: [dpdk-dev] [PATCH] net/iavf: fix mbuf leak
> 
> 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>

Applied to dpdk-next-net-intel.

Thanks
Qi
  

Patch

diff --git a/drivers/net/iavf/iavf_rxtx.c b/drivers/net/iavf/iavf_rxtx.c
index 55393a9400..59448eae98 100644
--- a/drivers/net/iavf/iavf_rxtx.c
+++ b/drivers/net/iavf/iavf_rxtx.c
@@ -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;