DPDK patches and discussions
 help / color / mirror / Atom feed
From: "Dumitrescu, Cristian" <cristian.dumitrescu@intel.com>
To: "Gajdzica, MaciejX T" <maciejx.t.gajdzica@intel.com>,
	"dev@dpdk.org" <dev@dpdk.org>
Subject: Re: [dpdk-dev] [PATCH] table: fix a crash during key8 and key32 overload
Date: Mon, 23 Mar 2015 15:20:02 +0000
Message-ID: <3EB4FA525960D640B5BDFFD6A3D89126323382BD@IRSMSX108.ger.corp.intel.com> (raw)
In-Reply-To: <1427123347-16200-1-git-send-email-maciejx.t.gajdzica@intel.com>



> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Maciej Gajdzica
> Sent: Monday, March 23, 2015 3:09 PM
> To: dev@dpdk.org
> Subject: [dpdk-dev] [PATCH] table: fix a crash during key8 and key32
> overload
> 
> hash_key8_ext and hash_key32_ext tables allocate 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 same case for key16 was fixed with earlier patch.
> 
> Signed-off-by: Maciej Gajdzica <maciejx.t.gajdzica@intel.com>
> ---
>  lib/librte_table/rte_table_hash_key32.c |    5 ++---
>  lib/librte_table/rte_table_hash_key8.c  |    5 ++---
>  2 files changed, 4 insertions(+), 6 deletions(-)
> 
> diff --git a/lib/librte_table/rte_table_hash_key32.c
> b/lib/librte_table/rte_table_hash_key32.c
> index da0ce6a..6790594 100644
> --- a/lib/librte_table/rte_table_hash_key32.c
> +++ b/lib/librte_table/rte_table_hash_key32.c
> @@ -540,9 +540,8 @@ rte_table_hash_entry_delete_key32_ext(
> 
>  					memset(bucket, 0,
>  						sizeof(struct
> rte_bucket_4_32));
> -					bucket_index = (bucket -
> -						((struct rte_bucket_4_32 *)
> -						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;
>  				}
> 
> diff --git a/lib/librte_table/rte_table_hash_key8.c
> b/lib/librte_table/rte_table_hash_key8.c
> index 443ca7d..6803eb2 100644
> --- a/lib/librte_table/rte_table_hash_key8.c
> +++ b/lib/librte_table/rte_table_hash_key8.c
> @@ -528,9 +528,8 @@ rte_table_hash_entry_delete_key8_ext(
> 
>  					memset(bucket, 0,
>  						sizeof(struct
> rte_bucket_4_8));
> -					bucket_index = (bucket -
> -						((struct rte_bucket_4_8 *)
> -						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;
>  				}
> 
> --
> 1.7.9.5

Acked by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>

Thanks, Maciej!

  reply	other threads:[~2015-03-23 15:20 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-23 15:09 Maciej Gajdzica
2015-03-23 15:20 ` Dumitrescu, Cristian [this message]
2015-03-23 15:22   ` Walukiewicz, Miroslaw
2015-03-27 11:19   ` Thomas Monjalon
2015-03-23 15:10 Maciej Gajdzica

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=3EB4FA525960D640B5BDFFD6A3D89126323382BD@IRSMSX108.ger.corp.intel.com \
    --to=cristian.dumitrescu@intel.com \
    --cc=dev@dpdk.org \
    --cc=maciejx.t.gajdzica@intel.com \
    /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

DPDK patches and discussions

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://inbox.dpdk.org/dev/0 dev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 dev dev/ https://inbox.dpdk.org/dev \
		dev@dpdk.org
	public-inbox-index dev

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://inbox.dpdk.org/inbox.dpdk.dev


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git