From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by dpdk.org (Postfix) with ESMTP id C337D379E for ; Mon, 23 Mar 2015 16:20:04 +0100 (CET) Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga102.fm.intel.com with ESMTP; 23 Mar 2015 08:20:03 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.11,452,1422950400"; d="scan'208";a="684295278" Received: from irsmsx104.ger.corp.intel.com ([163.33.3.159]) by fmsmga001.fm.intel.com with ESMTP; 23 Mar 2015 08:20:03 -0700 Received: from irsmsx108.ger.corp.intel.com ([169.254.11.49]) by IRSMSX104.ger.corp.intel.com ([169.254.5.138]) with mapi id 14.03.0224.002; Mon, 23 Mar 2015 15:20:02 +0000 From: "Dumitrescu, Cristian" To: "Gajdzica, MaciejX T" , "dev@dpdk.org" Thread-Topic: [dpdk-dev] [PATCH] table: fix a crash during key8 and key32 overload Thread-Index: AQHQZXv5+ZbWIgpuJkuoWUR/jAU/AJ0qLoPg Date: Mon, 23 Mar 2015 15:20:02 +0000 Message-ID: <3EB4FA525960D640B5BDFFD6A3D89126323382BD@IRSMSX108.ger.corp.intel.com> References: <1427123347-16200-1-git-send-email-maciejx.t.gajdzica@intel.com> In-Reply-To: <1427123347-16200-1-git-send-email-maciejx.t.gajdzica@intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [163.33.239.182] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH] table: fix a crash during key8 and key32 overload 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: Mon, 23 Mar 2015 15:20:05 -0000 > -----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 >=20 > 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. >=20 > Signed-off-by: Maciej Gajdzica > --- > 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(-) >=20 > 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( >=20 > memset(bucket, 0, > sizeof(struct > rte_bucket_4_32)); > - bucket_index =3D (bucket - > - ((struct rte_bucket_4_32 *) > - f->memory)) - f->n_buckets; > + bucket_index =3D (((uint8_t *)bucket - > + (uint8_t *)f->memory)/f- > >bucket_size) - f->n_buckets; > f->stack[f->stack_pos++] =3D > bucket_index; > } >=20 > 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( >=20 > memset(bucket, 0, > sizeof(struct > rte_bucket_4_8)); > - bucket_index =3D (bucket - > - ((struct rte_bucket_4_8 *) > - f->memory)) - f->n_buckets; > + bucket_index =3D (((uint8_t *)bucket - > + (uint8_t *)f->memory)/f- > >bucket_size) - f->n_buckets; > f->stack[f->stack_pos++] =3D > bucket_index; > } >=20 > -- > 1.7.9.5 Acked by: Cristian Dumitrescu Thanks, Maciej!