DPDK patches and discussions
 help / color / mirror / Atom feed
From: miroslaw.walukiewicz@intel.com
To: dev@dpdk.org
Subject: [dpdk-dev] [PATCH] dpdk: fix a crash during rte_table_hash_key16_ext overload
Date: Tue, 03 Mar 2015 09:16:00 -0500	[thread overview]
Message-ID: <20150303141600.13055.77862.stgit@gklab-18-011.igk.intel.com> (raw)

From: Miroslaw Walukiewicz <miroslaw.walukiewicz@intel.com>

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 <miroslaw.walukiewicz@intel.com>
---
 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;
 				}
 

             reply	other threads:[~2015-03-03 14:16 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-03 14:16 miroslaw.walukiewicz [this message]
2015-03-23 13:33 ` Dumitrescu, Cristian
2015-03-27 11:17   ` Thomas Monjalon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150303141600.13055.77862.stgit@gklab-18-011.igk.intel.com \
    --to=miroslaw.walukiewicz@intel.com \
    --cc=dev@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).