From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by dpdk.org (Postfix) with ESMTP id C8332288C; Fri, 18 Jan 2019 08:41:22 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 17 Jan 2019 23:41:21 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.56,489,1539673200"; d="scan'208";a="115626239" Received: from irvmail001.ir.intel.com ([163.33.26.43]) by fmsmga007.fm.intel.com with ESMTP; 17 Jan 2019 23:41:19 -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 x0I7fJ1u024499; Fri, 18 Jan 2019 07:41:19 GMT Received: from wgcvswdev001.ir.intel.com (localhost [127.0.0.1]) by wgcvswdev001.ir.intel.com with ESMTP id x0I7ek1U007879; Fri, 18 Jan 2019 07:40:46 GMT Received: (from hvemulax@localhost) by wgcvswdev001.ir.intel.com with œ id x0I7ejD1007873; Fri, 18 Jan 2019 07:40:45 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, 18 Jan 2019 07:40:42 +0000 Message-Id: <1547797242-7553-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 v5] 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, 18 Jan 2019 07:41:23 -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 Reviewed-by: Honnappa Nagarahalli Acked-by: Reshma Pattan Acked-by: Pablo de Lara --- v5: Removed NULL initialization 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..1a97ece05 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); + break; + } + } + + 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