From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by dpdk.org (Postfix) with ESMTP id 5FE835A51 for ; Mon, 23 Mar 2015 16:22:32 +0100 (CET) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga103.jf.intel.com with ESMTP; 23 Mar 2015 08:22:32 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.11,452,1422950400"; d="scan'208";a="702848888" Received: from irsmsx106.ger.corp.intel.com ([163.33.3.31]) by orsmga002.jf.intel.com with ESMTP; 23 Mar 2015 08:22:30 -0700 Received: from irsmsx104.ger.corp.intel.com ([169.254.5.138]) by IRSMSX106.ger.corp.intel.com ([163.33.3.31]) with mapi id 14.03.0224.002; Mon, 23 Mar 2015 15:22:28 +0000 From: "Walukiewicz, Miroslaw" To: "Dumitrescu, Cristian" , "Gajdzica, MaciejX T" , "dev@dpdk.org" Thread-Topic: [dpdk-dev] [PATCH] table: fix a crash during key8 and key32 overload Thread-Index: AQHQZXv5EyYWDQS3nkusw/SvExXuNp0qLrIAgAAAfeA= Date: Mon, 23 Mar 2015 15:22:28 +0000 Message-ID: <7C4248CAE043B144B1CD242D275626532FE76AC4@IRSMSX104.ger.corp.intel.com> References: <1427123347-16200-1-git-send-email-maciejx.t.gajdzica@intel.com> <3EB4FA525960D640B5BDFFD6A3D89126323382BD@IRSMSX108.ger.corp.intel.com> In-Reply-To: <3EB4FA525960D640B5BDFFD6A3D89126323382BD@IRSMSX108.ger.corp.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:22:32 -0000 Reviewed-by: Mirek Walukiewicz > -----Original Message----- > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Dumitrescu, Cristian > Sent: Monday, March 23, 2015 4:20 PM > To: Gajdzica, MaciejX T; dev@dpdk.org > Subject: Re: [dpdk-dev] [PATCH] table: fix a crash during key8 and key32 > overload >=20 >=20 >=20 > > -----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 > > --- > > 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 =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; > > } > > > > 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 =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; > > } > > > > -- > > 1.7.9.5 >=20 > Acked by: Cristian Dumitrescu >=20 > Thanks, Maciej!