Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 14 May 2020 20:43:44 +0000 (UTC)
From:      Eric Joyner <erj@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org
Subject:   svn commit: r361058 - stable/11/sys/net
Message-ID:  <202005142043.04EKhivo090012@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: erj
Date: Thu May 14 20:43:44 2020
New Revision: 361058
URL: https://svnweb.freebsd.org/changeset/base/361058

Log:
  MFC r354207: iflib: cleanup memory leaks on driver detach
  
  Sponsored by:	Intel Corporation

Modified:
  stable/11/sys/net/iflib.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/net/iflib.c
==============================================================================
--- stable/11/sys/net/iflib.c	Thu May 14 20:23:25 2020	(r361057)
+++ stable/11/sys/net/iflib.c	Thu May 14 20:43:44 2020	(r361058)
@@ -1613,6 +1613,14 @@ iflib_txq_destroy(iflib_txq_t txq)
 
 	for (int i = 0; i < txq->ift_size; i++)
 		iflib_txsd_destroy(ctx, txq, i);
+
+	if (txq->ift_br != NULL) {
+		ifmp_ring_free(txq->ift_br);
+		txq->ift_br = NULL;
+	}
+
+	mtx_destroy(&txq->ift_mtx);
+
 	if (txq->ift_sds.ifsd_map != NULL) {
 		free(txq->ift_sds.ifsd_map, M_IFLIB);
 		txq->ift_sds.ifsd_map = NULL;
@@ -1633,6 +1641,9 @@ iflib_txq_destroy(iflib_txq_t txq)
 		bus_dma_tag_destroy(txq->ift_tso_desc_tag);
 		txq->ift_tso_desc_tag = NULL;
 	}
+	if (txq->ift_ifdi != NULL) {
+		free(txq->ift_ifdi, M_IFLIB);
+	}
 }
 
 static void
@@ -2104,6 +2115,8 @@ iflib_rx_sds_free(iflib_rxq_t rxq)
 		free(rxq->ifr_fl, M_IFLIB);
 		rxq->ifr_fl = NULL;
 		rxq->ifr_cq_gen = rxq->ifr_cq_cidx = rxq->ifr_cq_pidx = 0;
+		free(rxq->ifr_ifdi, M_IFLIB);
+		rxq->ifr_ifdi = NULL;
 	}
 }
 
@@ -5095,9 +5108,9 @@ iflib_tx_structures_free(if_ctx_t ctx)
 	int i, j;
 
 	for (i = 0; i < NTXQSETS(ctx); i++, txq++) {
-		iflib_txq_destroy(txq);
 		for (j = 0; j < ctx->ifc_nhwtxqs; j++)
 			iflib_dma_free(&txq->ift_ifdi[j]);
+		iflib_txq_destroy(txq);
 	}
 	free(ctx->ifc_txqs, M_IFLIB);
 	ctx->ifc_txqs = NULL;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202005142043.04EKhivo090012>