From mboxrd@z Thu Jan 1 00:00:00 1970 From: miroslaw.walukiewicz-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org Subject: [PATCH] dpdk: fix a crash during rte_table_hash_key16_ext overload Date: Tue, 03 Mar 2015 09:16:00 -0500 Message-ID: <20150303141600.13055.77862.stgit@gklab-18-011.igk.intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit To: dev-VfR2kkLFssw@public.gmane.org Return-path: List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces-VfR2kkLFssw@public.gmane.org Sender: "dev" From: Miroslaw Walukiewicz The hash_key16_ext table allocates a cache entries to support table overload cases. The crash can occur when cache entry is free after use. The problem is with computing the index of the free cache entry. The patch fixes a problem. Signed-off-by: Mirek Walukiewicz --- lib/librte_table/rte_table_hash_key16.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/lib/librte_table/rte_table_hash_key16.c b/lib/librte_table/rte_table_hash_key16.c index ee5f639..e0c99bd 100644 --- a/lib/librte_table/rte_table_hash_key16.c +++ b/lib/librte_table/rte_table_hash_key16.c @@ -535,9 +535,8 @@ rte_table_hash_entry_delete_key16_ext( memset(bucket, 0, sizeof(struct rte_bucket_4_16)); - bucket_index = (bucket - - ((struct rte_bucket_4_16 *) - f->memory)) - f->n_buckets; + bucket_index = (((uint8_t *)bucket - + (uint8_t *)f->memory)/f->bucket_size) - f->n_buckets; f->stack[f->stack_pos++] = bucket_index; }