From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by dpdk.org (Postfix) with ESMTP id B0A51C3E4 for ; Tue, 28 Jul 2015 17:02:46 +0200 (CEST) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga103.jf.intel.com with ESMTP; 28 Jul 2015 08:02:27 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.15,563,1432623600"; d="scan'208";a="772846151" Received: from xsimonar-mobl1.ger.corp.intel.com (HELO emea-ivb001.mcplab.net) ([172.22.195.65]) by orsmga002.jf.intel.com with ESMTP; 28 Jul 2015 08:02:25 -0700 From: Xavier Simonart To: dev@dpdk.org, xavier.simonart@intel.com Date: Tue, 28 Jul 2015 16:54:39 +0200 Message-Id: <1438095279-234959-1-git-send-email-xavier.simonart@intel.com> X-Mailer: git-send-email 1.8.3.1 Subject: [dpdk-dev] [PATCH] hash: fix crash when adding already inserted keys X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Jul 2015 15:02:47 -0000 When adding with cuckoo hash a key which was already inserted a new slot is dequeued and then enqueued back, but the enqueue operation was not done properly. Signed-off-by: Xavier Simonart --- lib/librte_hash/rte_cuckoo_hash.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/librte_hash/rte_cuckoo_hash.c b/lib/librte_hash/rte_cuckoo_hash.c index 5cf4af6..4da859a 100644 --- a/lib/librte_hash/rte_cuckoo_hash.c +++ b/lib/librte_hash/rte_cuckoo_hash.c @@ -509,7 +509,7 @@ __rte_hash_add_key_with_hash(const struct rte_hash *h, const void *key, k = (struct rte_hash_key *) ((char *)keys + prim_bkt->key_idx[i] * h->key_entry_size); if (h->rte_hash_cmp_eq(key, k->key, h->key_len) == 0) { - rte_ring_sp_enqueue(h->free_slots, &slot_id); + rte_ring_sp_enqueue(h->free_slots, slot_id); /* Update data */ k->pdata = data; /* @@ -528,7 +528,7 @@ __rte_hash_add_key_with_hash(const struct rte_hash *h, const void *key, k = (struct rte_hash_key *) ((char *)keys + sec_bkt->key_idx[i] * h->key_entry_size); if (h->rte_hash_cmp_eq(key, k->key, h->key_len) == 0) { - rte_ring_sp_enqueue(h->free_slots, &slot_id); + rte_ring_sp_enqueue(h->free_slots, slot_id); /* Update data */ k->pdata = data; /* -- 1.8.3.1