From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by dpdk.org (Postfix) with ESMTP id 495D01041; Wed, 13 Sep 2017 05:22:42 +0200 (CEST) Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 12 Sep 2017 20:22:41 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.42,385,1500966000"; d="scan'208";a="151210425" Received: from fmsmsx106.amr.corp.intel.com ([10.18.124.204]) by fmsmga006.fm.intel.com with ESMTP; 12 Sep 2017 20:22:41 -0700 Received: from fmsmsx126.amr.corp.intel.com (10.18.125.43) by FMSMSX106.amr.corp.intel.com (10.18.124.204) with Microsoft SMTP Server (TLS) id 14.3.319.2; Tue, 12 Sep 2017 20:22:40 -0700 Received: from shsmsx103.ccr.corp.intel.com (10.239.4.69) by FMSMSX126.amr.corp.intel.com (10.18.125.43) with Microsoft SMTP Server (TLS) id 14.3.319.2; Tue, 12 Sep 2017 20:22:40 -0700 Received: from shsmsx101.ccr.corp.intel.com ([169.254.1.168]) by SHSMSX103.ccr.corp.intel.com ([169.254.4.219]) with mapi id 14.03.0319.002; Wed, 13 Sep 2017 11:22:38 +0800 From: "Xing, Beilei" To: "Wu, Jingjing" CC: "dev@dpdk.org" , "stable@dpdk.org" Thread-Topic: [PATCH v2] net/i40e: fix memory leak if VF init fails Thread-Index: AQHTLDnYNFNVKUla4UiWHkoajSyV26KyJb4A Date: Wed, 13 Sep 2017 03:22:37 +0000 Message-ID: <94479800C636CB44BD422CB454846E013201C0E8@SHSMSX101.ccr.corp.intel.com> References: <1505244002-51248-1-git-send-email-jingjing.wu@intel.com> <1505244231-51364-1-git-send-email-jingjing.wu@intel.com> In-Reply-To: <1505244231-51364-1-git-send-email-jingjing.wu@intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH v2] net/i40e: fix memory leak if VF init fails X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Sep 2017 03:22:42 -0000 > -----Original Message----- > From: Wu, Jingjing > Sent: Wednesday, September 13, 2017 3:24 AM > To: Xing, Beilei > Cc: dev@dpdk.org; Wu, Jingjing ; stable@dpdk.org > Subject: [PATCH v2] net/i40e: fix memory leak if VF init fails >=20 > Cc: stable@dpdk.org > Fixes: 4861cde46116 ("i40e: new poll mode driver") >=20 > Signed-off-by: Jingjing Wu > --- > v2 change: > - free aq_resp at err_aq >=20 > drivers/net/i40e/i40e_ethdev_vf.c | 2 ++ > 1 file changed, 2 insertions(+) >=20 > diff --git a/drivers/net/i40e/i40e_ethdev_vf.c > b/drivers/net/i40e/i40e_ethdev_vf.c > index f6d8293..1206af1 100644 > --- a/drivers/net/i40e/i40e_ethdev_vf.c > +++ b/drivers/net/i40e/i40e_ethdev_vf.c > @@ -1317,7 +1317,9 @@ i40evf_init_vf(struct rte_eth_dev *dev) >=20 > err_alloc: > rte_free(vf->vf_res); > + vf->vsi_res =3D NULL; > err_aq: > + rte_free(vf->aq_resp); Seems it's inappropriate to free aq_resp here, if reset NIC failed, vf->aq_= resp is not allocated yet. /* Reset VF and wait until it's complete */ if (i40evf_reset_vf(hw)) { PMD_INIT_LOG(ERR, "reset NIC failed"); goto err_aq; } How about adding a new error branch? > i40e_shutdown_adminq(hw); /* ignore error */ > err: > return -1; > -- > 2.7.4