From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by dpdk.org (Postfix) with ESMTP id F3D4E7CFD; Wed, 13 Sep 2017 07:39:45 +0200 (CEST) Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 12 Sep 2017 22:39:44 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.42,386,1500966000"; d="scan'208";a="150721376" Received: from fmsmsx104.amr.corp.intel.com ([10.18.124.202]) by fmsmga005.fm.intel.com with ESMTP; 12 Sep 2017 22:39:44 -0700 Received: from fmsmsx115.amr.corp.intel.com (10.18.116.19) by fmsmsx104.amr.corp.intel.com (10.18.124.202) with Microsoft SMTP Server (TLS) id 14.3.319.2; Tue, 12 Sep 2017 22:39:44 -0700 Received: from shsmsx151.ccr.corp.intel.com (10.239.6.50) by fmsmsx115.amr.corp.intel.com (10.18.116.19) with Microsoft SMTP Server (TLS) id 14.3.319.2; Tue, 12 Sep 2017 22:39:44 -0700 Received: from shsmsx103.ccr.corp.intel.com ([169.254.4.219]) by SHSMSX151.ccr.corp.intel.com ([169.254.3.98]) with mapi id 14.03.0319.002; Wed, 13 Sep 2017 13:39:41 +0800 From: "Wu, Jingjing" To: "Xing, Beilei" CC: "dev@dpdk.org" , "stable@dpdk.org" Thread-Topic: [PATCH v2] net/i40e: fix memory leak if VF init fails Thread-Index: AQHTLDnYzr77cbYzfkuWrcQkWdxVU6KxoIiAgACsMqA= Date: Wed, 13 Sep 2017 05:39:42 +0000 Message-ID: <9BB6961774997848B5B42BEC655768F810E48B13@SHSMSX103.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> <94479800C636CB44BD422CB454846E013201C0E8@SHSMSX101.ccr.corp.intel.com> In-Reply-To: <94479800C636CB44BD422CB454846E013201C0E8@SHSMSX101.ccr.corp.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 05:39:46 -0000 > -----Original Message----- > From: Xing, Beilei > Sent: Wednesday, September 13, 2017 11:23 AM > To: Wu, Jingjing > Cc: dev@dpdk.org; stable@dpdk.org > Subject: RE: [PATCH v2] net/i40e: fix memory leak if VF init fails >=20 >=20 >=20 > > -----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 > > > > Cc: stable@dpdk.org > > Fixes: 4861cde46116 ("i40e: new poll mode driver") > > > > Signed-off-by: Jingjing Wu > > --- > > v2 change: > > - free aq_resp at err_aq > > > > drivers/net/i40e/i40e_ethdev_vf.c | 2 ++ > > 1 file changed, 2 insertions(+) > > > > 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) > > > > err_alloc: > > rte_free(vf->vf_res); > > + vf->vsi_res =3D NULL; > > err_aq: > > + rte_free(vf->aq_resp); >=20 > Seems it's inappropriate to free aq_resp here, if reset NIC failed, vf->a= q_resp is > not allocated yet. >=20 > /* Reset VF and wait until it's complete */ > if (i40evf_reset_vf(hw)) { > PMD_INIT_LOG(ERR, "reset NIC failed"); > goto err_aq; > } >=20 > How about adding a new error branch? Yes, a new version will be sent. Thanks Jingjing