All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] dpdk: fix a crash during rte_table_hash_key16_ext overload
@ 2015-03-03 14:16 miroslaw.walukiewicz-ral2JQCrhuEAvxtiuMwx3w
       [not found] ` <20150303141600.13055.77862.stgit-tpi2AMbES9qir5R1eWH9hGt3HXsI98Cx0E9HWUfgJXw@public.gmane.org>
  0 siblings, 1 reply; 3+ messages in thread
From: miroslaw.walukiewicz-ral2JQCrhuEAvxtiuMwx3w @ 2015-03-03 14:16 UTC (permalink / raw)
  To: dev-VfR2kkLFssw

From: Miroslaw Walukiewicz <miroslaw.walukiewicz-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>

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-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
---
 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;
 				}
 

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] dpdk: fix a crash during rte_table_hash_key16_ext overload
       [not found] ` <20150303141600.13055.77862.stgit-tpi2AMbES9qir5R1eWH9hGt3HXsI98Cx0E9HWUfgJXw@public.gmane.org>
@ 2015-03-23 13:33   ` Dumitrescu, Cristian
       [not found]     ` <3EB4FA525960D640B5BDFFD6A3D89126323370FC-kPTMFJFq+rEMvF1YICWikbfspsVTdybXVpNB7YpNyf8@public.gmane.org>
  0 siblings, 1 reply; 3+ messages in thread
From: Dumitrescu, Cristian @ 2015-03-23 13:33 UTC (permalink / raw)
  To: Walukiewicz, Miroslaw, dev-VfR2kkLFssw; +Cc: Nemeth, Balazs



> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of
> miroslaw.walukiewicz@intel.com
> Sent: Tuesday, March 3, 2015 2:16 PM
> To: dev@dpdk.org
> Subject: [dpdk-dev] [PATCH] dpdk: fix a crash during
> rte_table_hash_key16_ext overload
> 
> 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;
>  				}
> 

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

Mirek, identical issue is found at identical place in rte_table_hash_key8.c and rte_table_hash_key32.c, would you please submit the same fix for those as well?

Thanks,
Cristian


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] dpdk: fix a crash during rte_table_hash_key16_ext overload
       [not found]     ` <3EB4FA525960D640B5BDFFD6A3D89126323370FC-kPTMFJFq+rEMvF1YICWikbfspsVTdybXVpNB7YpNyf8@public.gmane.org>
@ 2015-03-27 11:17       ` Thomas Monjalon
  0 siblings, 0 replies; 3+ messages in thread
From: Thomas Monjalon @ 2015-03-27 11:17 UTC (permalink / raw)
  To: Walukiewicz, Miroslaw; +Cc: dev-VfR2kkLFssw, Nemeth, Balazs

> > 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-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
> 
> Acked by: Cristian Dumitrescu <cristian.dumitrescu-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>

Applied, thanks

> Mirek, identical issue is found at identical place in rte_table_hash_key8.c
> and rte_table_hash_key32.c, would you please submit the same fix for those as well?

Merged (Maciej's patch)

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-03-27 11:17 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-03 14:16 [PATCH] dpdk: fix a crash during rte_table_hash_key16_ext overload miroslaw.walukiewicz-ral2JQCrhuEAvxtiuMwx3w
     [not found] ` <20150303141600.13055.77862.stgit-tpi2AMbES9qir5R1eWH9hGt3HXsI98Cx0E9HWUfgJXw@public.gmane.org>
2015-03-23 13:33   ` Dumitrescu, Cristian
     [not found]     ` <3EB4FA525960D640B5BDFFD6A3D89126323370FC-kPTMFJFq+rEMvF1YICWikbfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2015-03-27 11:17       ` Thomas Monjalon

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.