From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 88256A0C43; Wed, 15 Sep 2021 05:28:03 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 6E4FC4014F; Wed, 15 Sep 2021 05:28:03 +0200 (CEST) Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by mails.dpdk.org (Postfix) with ESMTP id 0392F4003C; Wed, 15 Sep 2021 05:28:00 +0200 (CEST) X-IronPort-AV: E=McAfee;i="6200,9189,10107"; a="283198301" X-IronPort-AV: E=Sophos;i="5.85,294,1624345200"; d="scan'208";a="283198301" Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Sep 2021 20:27:56 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.85,294,1624345200"; d="scan'208";a="699831201" Received: from fmsmsx605.amr.corp.intel.com ([10.18.126.85]) by fmsmga005.fm.intel.com with ESMTP; 14 Sep 2021 20:27:56 -0700 Received: from shsmsx604.ccr.corp.intel.com (10.109.6.214) by fmsmsx605.amr.corp.intel.com (10.18.126.85) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.12; Tue, 14 Sep 2021 20:27:55 -0700 Received: from shsmsx601.ccr.corp.intel.com (10.109.6.141) by SHSMSX604.ccr.corp.intel.com (10.109.6.214) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.12; Wed, 15 Sep 2021 11:27:53 +0800 Received: from shsmsx601.ccr.corp.intel.com ([10.109.6.141]) by SHSMSX601.ccr.corp.intel.com ([10.109.6.141]) with mapi id 15.01.2242.012; Wed, 15 Sep 2021 11:27:53 +0800 From: "Zhang, Qi Z" To: Qiming Chen , "dev@dpdk.org" CC: "Xing, Beilei" , "Wu, Jingjing" , "stable@dpdk.org" Thread-Topic: [dpdk-dev] [PATCH v2] net/iavf: fix mbuf leak Thread-Index: AQHXph5vj7LCAFHCUEaPB01d9g1OX6ukdcYw Date: Wed, 15 Sep 2021 03:27:53 +0000 Message-ID: References: <20210910082318.12755-1-chenqiming_huawei@163.com> <20210910083138.12867-1-chenqiming_huawei@163.com> In-Reply-To: <20210910083138.12867-1-chenqiming_huawei@163.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-reaction: no-action dlp-version: 11.6.200.16 dlp-product: dlpe-windows x-originating-ip: [10.239.127.36] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH v2] net/iavf: fix mbuf leak X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" > -----Original Message----- > From: dev On Behalf Of Qiming Chen > Sent: Friday, September 10, 2021 4:32 PM > To: dev@dpdk.org > Cc: Xing, Beilei ; Wu, Jingjing ; > Qiming Chen ; stable@dpdk.org > Subject: [dpdk-dev] [PATCH v2] net/iavf: fix mbuf leak >=20 > In the iavf_dev_rx_queue_start function, if the iavf_switch_queue or > iavf_switch_queue_lv function fails, the previously applied mbuf is not > released, resulting in leakage. The patch fixes the problem. >=20 > Fixes: 9cf9c02bf6ee ("net/iavf: add enable/disable queues for large VF") > Cc: stable@dpdk.org >=20 > Signed-off-by: Qiming Chen > --- > v2: > Modify coding style warning. > --- > drivers/net/iavf/iavf_rxtx.c | 6 ++++-- > 1 file changed, 4 insertions(+), 2 deletions(-) >=20 > diff --git a/drivers/net/iavf/iavf_rxtx.c b/drivers/net/iavf/iavf_rxtx.c = index > e33fe4576b..55393a9400 100644 > --- a/drivers/net/iavf/iavf_rxtx.c > +++ b/drivers/net/iavf/iavf_rxtx.c > @@ -848,12 +848,14 @@ iavf_dev_rx_queue_start(struct rte_eth_dev *dev, > uint16_t rx_queue_id) > else > err =3D iavf_switch_queue_lv(adapter, rx_queue_id, true, true); >=20 > - if (err) > + if (err) { > + release_rxq_mbufs(rxq); This looks good, but I saw another potential memory leak in " alloc_rxq_mbu= fs", It is the case when only part of the memory are available, the already allo= cated mbuf not be released before return -ENOMEM for (i =3D 0; i < rxq->nb_rx_desc; i++) { mbuf =3D rte_mbuf_raw_alloc(rxq->mp); if (unlikely(!mbuf)) { PMD_DRV_LOG(ERR, "Failed to allocate mbuf for RX"); return -ENOMEM; } Do you mind to merge them into the same patch? Thanks. > PMD_DRV_LOG(ERR, "Failed to switch RX queue %u on", > rx_queue_id); > - else > + } else { > dev->data->rx_queue_state[rx_queue_id] =3D > RTE_ETH_QUEUE_STATE_STARTED; > + } >=20 > return err; > } > -- > 2.30.1.windows.1