From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by dpdk.org (Postfix) with ESMTP id 015691B99F; Fri, 11 Jan 2019 12:49:55 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga107.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 11 Jan 2019 03:49:55 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.56,465,1539673200"; d="scan'208";a="309545499" Received: from irvmail001.ir.intel.com ([163.33.26.43]) by fmsmga006.fm.intel.com with ESMTP; 11 Jan 2019 03:49:53 -0800 Received: from wgcvswdev001.ir.intel.com (wgcvswdev001.ir.intel.com [10.102.246.100]) by irvmail001.ir.intel.com (8.14.3/8.13.6/MailSET/Hub) with ESMTP id x0BBnrZh022366; Fri, 11 Jan 2019 11:49:53 GMT Received: from wgcvswdev001.ir.intel.com (localhost [127.0.0.1]) by wgcvswdev001.ir.intel.com with ESMTP id x0BBnKvD022343; Fri, 11 Jan 2019 11:49:20 GMT Received: (from hvemulax@localhost) by wgcvswdev001.ir.intel.com with œ id x0BBnKPB022339; Fri, 11 Jan 2019 11:49:20 GMT From: Hari Kumar Vemula To: dev@dpdk.org Cc: byron.marohn@intel.com, reshma.pattan@intel.com, pablo.de.lara.guarch@intel.com, jananeex.m.parthasarathy@intel.com, Hari Kumar Vemula , stable@dpdk.org Date: Fri, 11 Jan 2019 11:49:01 +0000 Message-Id: <1547207341-22001-1-git-send-email-hari.kumarx.vemula@intel.com> X-Mailer: git-send-email 1.7.0.7 In-Reply-To: <1542109533-14283-1-git-send-email-hari.kumarx.vemula@intel.com> References: <1542109533-14283-1-git-send-email-hari.kumarx.vemula@intel.com> Subject: [dpdk-dev] [PATCH v3] 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: Fri, 11 Jan 2019 11:49:56 -0000 In rte_efd_create() allocated memory for tail queue entry but not freed. Added freeing the tail queue entry. Fixes: 56b6ef874f80 ("efd: new Elastic Flow Distributor library") Cc: stable@dpdk.org Signed-off-by: Hari Kumar Vemula Acked-by: Reshma Pattan --- v3: Replaced TAILQ_FOREACH_SAFE with TAILQ_FOREACH v2: Updated commit message. --- lib/librte_efd/rte_efd.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/lib/librte_efd/rte_efd.c b/lib/librte_efd/rte_efd.c index e6e5cfda2..8b8330e0b 100644 --- a/lib/librte_efd/rte_efd.c +++ b/lib/librte_efd/rte_efd.c @@ -740,17 +740,32 @@ 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; if (table == NULL) return; + efd_list = RTE_TAILQ_CAST(rte_efd_tailq.head, rte_efd_list); + for (socket_id = 0; socket_id < RTE_MAX_NUMA_NODES; socket_id++) rte_free(table->chunks[socket_id]); + rte_rwlock_write_lock(RTE_EAL_TAILQ_RWLOCK); + TAILQ_FOREACH_SAFE(te, efd_list, next, temp) { + if (te->data == (void *) table) { + TAILQ_REMOVE(efd_list, te, next); + rte_free(te); + te = NULL; + } + } + + rte_rwlock_write_unlock(RTE_EAL_TAILQ_RWLOCK); rte_ring_free(table->free_slots); rte_free(table->offline_chunks); rte_free(table->keys); rte_free(table); + } /** -- 2.17.2