From owner-svn-src-stable-11@freebsd.org Thu May 14 20:43:44 2020 Return-Path: Delivered-To: svn-src-stable-11@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E6C2A2DF161; Thu, 14 May 2020 20:43:44 +0000 (UTC) (envelope-from erj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49NNmc5jl1z3Q5r; Thu, 14 May 2020 20:43:44 +0000 (UTC) (envelope-from erj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BF7D5190C7; Thu, 14 May 2020 20:43:44 +0000 (UTC) (envelope-from erj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 04EKhipp090013; Thu, 14 May 2020 20:43:44 GMT (envelope-from erj@FreeBSD.org) Received: (from erj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 04EKhivo090012; Thu, 14 May 2020 20:43:44 GMT (envelope-from erj@FreeBSD.org) Message-Id: <202005142043.04EKhivo090012@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: erj set sender to erj@FreeBSD.org using -f From: Eric Joyner Date: Thu, 14 May 2020 20:43:44 +0000 (UTC) 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 X-SVN-Group: stable-11 X-SVN-Commit-Author: erj X-SVN-Commit-Paths: stable/11/sys/net X-SVN-Commit-Revision: 361058 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 May 2020 20:43:45 -0000 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;