From owner-svn-src-stable@freebsd.org Mon May 7 23:10:03 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 401F1FC0B77; Mon, 7 May 2018 23:10:03 +0000 (UTC) (envelope-from shurd@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id E00C16DAFD; Mon, 7 May 2018 23:10:02 +0000 (UTC) (envelope-from shurd@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 D63B921D7F; Mon, 7 May 2018 23:10:02 +0000 (UTC) (envelope-from shurd@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w47NA2QZ087193; Mon, 7 May 2018 23:10:02 GMT (envelope-from shurd@FreeBSD.org) Received: (from shurd@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w47NA2we087192; Mon, 7 May 2018 23:10:02 GMT (envelope-from shurd@FreeBSD.org) Message-Id: <201805072310.w47NA2we087192@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: shurd set sender to shurd@FreeBSD.org using -f From: Stephen Hurd Date: Mon, 7 May 2018 23:10:02 +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: r333341 - stable/11/sys/net X-SVN-Group: stable-11 X-SVN-Commit-Author: shurd X-SVN-Commit-Paths: stable/11/sys/net X-SVN-Commit-Revision: 333341 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@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 May 2018 23:10:03 -0000 Author: shurd Date: Mon May 7 23:10:02 2018 New Revision: 333341 URL: https://svnweb.freebsd.org/changeset/base/333341 Log: MFC r333253-r333254 Fixes invalid free()s when iflib_queues_alloc() fails, and remove unused brscp variable. Approved by: re (gjb@) 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 Mon May 7 22:33:40 2018 (r333340) +++ stable/11/sys/net/iflib.c Mon May 7 23:10:02 2018 (r333341) @@ -4719,17 +4719,12 @@ iflib_queues_alloc(if_ctx_t ctx) int nfree_lists = sctx->isc_nfl ? sctx->isc_nfl : 1; caddr_t *vaddrs; uint64_t *paddrs; - struct ifmp_ring **brscp; KASSERT(ntxqs > 0, ("number of queues per qset must be at least 1")); KASSERT(nrxqs > 0, ("number of queues per qset must be at least 1")); - brscp = NULL; - txq = NULL; - rxq = NULL; - /* Allocate the TX ring struct memory */ - if (!(txq = + if (!(ctx->ifc_txqs = (iflib_txq_t) malloc(sizeof(struct iflib_txq) * ntxqsets, M_IFLIB, M_NOWAIT | M_ZERO))) { device_printf(dev, "Unable to allocate TX ring memory\n"); @@ -4738,7 +4733,7 @@ iflib_queues_alloc(if_ctx_t ctx) } /* Now allocate the RX */ - if (!(rxq = + if (!(ctx->ifc_rxqs = (iflib_rxq_t) malloc(sizeof(struct iflib_rxq) * nrxqsets, M_IFLIB, M_NOWAIT | M_ZERO))) { device_printf(dev, "Unable to allocate RX ring memory\n"); @@ -4746,8 +4741,8 @@ iflib_queues_alloc(if_ctx_t ctx) goto rx_fail; } - ctx->ifc_txqs = txq; - ctx->ifc_rxqs = rxq; + txq = ctx->ifc_txqs; + rxq = ctx->ifc_rxqs; /* * XXX handle allocation failure @@ -4905,19 +4900,13 @@ iflib_queues_alloc(if_ctx_t ctx) /* XXX handle allocation failure changes */ err_rx_desc: err_tx_desc: +rx_fail: if (ctx->ifc_rxqs != NULL) free(ctx->ifc_rxqs, M_IFLIB); ctx->ifc_rxqs = NULL; if (ctx->ifc_txqs != NULL) free(ctx->ifc_txqs, M_IFLIB); ctx->ifc_txqs = NULL; -rx_fail: - if (brscp != NULL) - free(brscp, M_IFLIB); - if (rxq != NULL) - free(rxq, M_IFLIB); - if (txq != NULL) - free(txq, M_IFLIB); fail: return (err); }