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 C6F802904; Thu, 17 Jan 2019 14:37:31 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 17 Jan 2019 05:37:30 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.56,489,1539673200"; d="scan'208";a="135454617" Received: from irvmail001.ir.intel.com ([163.33.26.43]) by fmsmga002.fm.intel.com with ESMTP; 17 Jan 2019 05:37:29 -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 x0HDbS7s012299; Thu, 17 Jan 2019 13:37:28 GMT Received: from wgcvswdev001.ir.intel.com (localhost [127.0.0.1]) by wgcvswdev001.ir.intel.com with ESMTP id x0HDatxo013373; Thu, 17 Jan 2019 13:36:55 GMT Received: (from hvemulax@localhost) by wgcvswdev001.ir.intel.com with œ id x0HDatLf013369; Thu, 17 Jan 2019 13:36:55 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: Thu, 17 Jan 2019 13:36:39 +0000 Message-Id: <1547732199-12201-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 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 13:37:32 -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 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(+) 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; if (table == NULL) return; @@ -747,6 +749,18 @@ rte_efd_free(struct rte_efd_table *table) for (socket_id = 0; socket_id < RTE_MAX_NUMA_NODES; socket_id++) rte_free(table->chunks[socket_id]); + efd_list = 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 == (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); -- 2.17.2