From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by dpdk.org (Postfix) with ESMTP id 01C3C2082; Thu, 17 Jan 2019 17:41:38 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 17 Jan 2019 08:41:38 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.56,489,1539673200"; d="scan'208";a="128604055" Received: from irsmsx102.ger.corp.intel.com ([163.33.3.155]) by orsmga001.jf.intel.com with ESMTP; 17 Jan 2019 08:41:37 -0800 Received: from irsmsx112.ger.corp.intel.com ([169.254.1.84]) by IRSMSX102.ger.corp.intel.com ([169.254.2.65]) with mapi id 14.03.0415.000; Thu, 17 Jan 2019 16:41:36 +0000 From: "De Lara Guarch, Pablo" To: "Vemula, Hari KumarX" , "dev@dpdk.org" CC: "Marohn, Byron" , "Pattan, Reshma" , "Parthasarathy, JananeeX M" , "stable@dpdk.org" Thread-Topic: [PATCH v4] lib/efd: fix to free tail queue entry after use Thread-Index: AQHUrmnWS4GUv4by60anfYXzlmWusaWzqeLQ Date: Thu, 17 Jan 2019 16:41:35 +0000 Message-ID: References: <1542109533-14283-1-git-send-email-hari.kumarx.vemula@intel.com> <1547732199-12201-1-git-send-email-hari.kumarx.vemula@intel.com> In-Reply-To: <1547732199-12201-1-git-send-email-hari.kumarx.vemula@intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiMjg5YjYxOGUtNjNmNC00NWYzLWJjNzYtZWEyNDFlYzc5YTRlIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoiN2xueUhja253dEtmdVJDYzk0TmF0enZqZThaSmRuVGlwdWs2VXZUUEJYU1R4NzFORFFBaHBQWit0VWZlT2FqMiJ9 x-ctpclassification: CTP_NT dlp-product: dlpe-windows dlp-version: 11.0.400.15 dlp-reaction: no-action x-originating-ip: [163.33.239.182] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH v4] lib/efd: fix to free tail queue entry after use 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: Thu, 17 Jan 2019 16:41:39 -0000 Hi, > -----Original Message----- > From: Vemula, Hari KumarX > Sent: Thursday, January 17, 2019 1:37 PM > To: dev@dpdk.org > Cc: Marohn, Byron ; Pattan, Reshma > ; De Lara Guarch, Pablo > ; Parthasarathy, JananeeX M > ; Vemula, Hari KumarX > ; stable@dpdk.org > Subject: [PATCH v4] lib/efd: fix to free tail queue entry after use >=20 > In rte_efd_create() allocated memory for tail queue entry but not freed. > Added freeing the tail queue entry. >=20 > Fixes: 56b6ef874f80 ("efd: new Elastic Flow Distributor library") > Cc: stable@dpdk.org >=20 > Signed-off-by: Hari Kumar Vemula > Acked-by: Reshma Pattan > Reviewed-by: Honnappa Nagarahalli > --- > v4: RTE_TAILQ_CAST moved after for loop > v3: Replaced TAILQ_FOREACH_SAFE with TAILQ_FOREACH > v2: Updated commit message. > --- > lib/librte_efd/rte_efd.c | 14 ++++++++++++++ > 1 file changed, 14 insertions(+) >=20 > diff --git a/lib/librte_efd/rte_efd.c b/lib/librte_efd/rte_efd.c index > e6e5cfda2..b19e707d8 100644 > --- a/lib/librte_efd/rte_efd.c > +++ b/lib/librte_efd/rte_efd.c > @@ -740,6 +740,8 @@ void > rte_efd_free(struct rte_efd_table *table) { > uint8_t socket_id; > + struct rte_efd_list *efd_list; > + struct rte_tailq_entry *te, *temp; >=20 > if (table =3D=3D NULL) > return; > @@ -747,6 +749,18 @@ rte_efd_free(struct rte_efd_table *table) > for (socket_id =3D 0; socket_id < RTE_MAX_NUMA_NODES; socket_id++) > rte_free(table->chunks[socket_id]); >=20 > + efd_list =3D RTE_TAILQ_CAST(rte_efd_tailq.head, rte_efd_list); > + rte_rwlock_write_lock(RTE_EAL_TAILQ_RWLOCK); > + > + TAILQ_FOREACH_SAFE(te, efd_list, next, temp) { > + if (te->data =3D=3D (void *) table) { > + TAILQ_REMOVE(efd_list, te, next); > + rte_free(te); > + te =3D NULL; No need to set te =3D NULL, as it is a local variable. Also, you can break here, as no duplicates are allowed. Apart from this two changes: Acked-by: Pablo de Lara