From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 4EA1AA04C0; Wed, 13 Nov 2019 09:44:33 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 23EE71BEF8; Wed, 13 Nov 2019 09:44:33 +0100 (CET) Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by dpdk.org (Postfix) with ESMTP id 3035D1BEEF for ; Wed, 13 Nov 2019 09:44:31 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 13 Nov 2019 00:44:30 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.68,299,1569308400"; d="scan'208";a="194602357" Received: from fmsmsx103.amr.corp.intel.com ([10.18.124.201]) by orsmga007.jf.intel.com with ESMTP; 13 Nov 2019 00:44:29 -0800 Received: from FMSMSX110.amr.corp.intel.com (10.18.116.10) by FMSMSX103.amr.corp.intel.com (10.18.124.201) with Microsoft SMTP Server (TLS) id 14.3.439.0; Wed, 13 Nov 2019 00:44:29 -0800 Received: from shsmsx103.ccr.corp.intel.com (10.239.4.69) by fmsmsx110.amr.corp.intel.com (10.18.116.10) with Microsoft SMTP Server (TLS) id 14.3.439.0; Wed, 13 Nov 2019 00:44:29 -0800 Received: from shsmsx101.ccr.corp.intel.com ([169.254.1.213]) by SHSMSX103.ccr.corp.intel.com ([169.254.4.60]) with mapi id 14.03.0439.000; Wed, 13 Nov 2019 16:44:27 +0800 From: "Yang, Qiming" To: "Wang, ShougangX" , "dev@dpdk.org" CC: "Zhang, Qi Z" Thread-Topic: [PATCH v5 4/4] net/ice: fix wild pointer Thread-Index: AQHVmff2ADcVTyh/AEO5mXvzoDM7maeIyRbg Date: Wed, 13 Nov 2019 08:44:26 +0000 Message-ID: References: <20191105033806.2878-1-shougangx.wang@intel.com> <20191113013758.39664-1-shougangx.wang@intel.com> <20191113013758.39664-5-shougangx.wang@intel.com> In-Reply-To: <20191113013758.39664-5-shougangx.wang@intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiOThhZjcxNmMtMTkxYi00ZWIyLTlmY2MtOTNhOGRkNTc4MjVkIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoiQTdjYk1hRzJvVDBaYW12cmVqWFhxZW1Cb3BGWWphNUdQXC84a2U1ZzNLOXJTbmgyOFBXS1RJTVp1NFpqMjA1ZFgifQ== x-ctpclassification: CTP_NT dlp-product: dlpe-windows dlp-version: 11.2.0.6 dlp-reaction: no-action x-originating-ip: [10.239.127.40] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH v5 4/4] net/ice: fix wild pointer X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Hi, > -----Original Message----- > From: Wang, ShougangX > Sent: Wednesday, November 13, 2019 9:38 AM > To: dev@dpdk.org > Cc: Yang, Qiming ; Zhang, Qi Z > ; Wang, ShougangX > Subject: [PATCH v5 4/4] net/ice: fix wild pointer >=20 > To avoid wild pointer, pointers should be set to NULL after free them. >=20 > Fixes: 1a2fc1799f09 ("net/ice: reject duplicated flow for flow director") > Fixes: 84dc7a95a2d3 ("net/ice: enable flow director engine") > Fixes: 0f880c3df192 ("net/ice: add flow director counter resource > init/release") >=20 > Signed-off-by: Wang ShougangX > --- > drivers/net/ice/ice_fdir_filter.c | 19 ++++++++++++++++--- > 1 file changed, 16 insertions(+), 3 deletions(-) >=20 > diff --git a/drivers/net/ice/ice_fdir_filter.c b/drivers/net/ice/ice_fdir= _filter.c > index e3b633e23..dd0e1b0c9 100644 > --- a/drivers/net/ice/ice_fdir_filter.c > +++ b/drivers/net/ice/ice_fdir_filter.c > @@ -167,9 +167,14 @@ ice_fdir_prof_alloc(struct ice_hw *hw) > fail_mem: > for (fltr_ptype =3D ICE_FLTR_PTYPE_NONF_NONE + 1; > fltr_ptype < ptype; > - fltr_ptype++) > + fltr_ptype++) { > rte_free(hw->fdir_prof[fltr_ptype]); > + hw->fdir_prof[fltr_ptype] =3D NULL; > + } > + > rte_free(hw->fdir_prof); > + hw->fdir_prof =3D NULL; > + > return -ENOMEM; > } >=20 > @@ -249,8 +254,10 @@ ice_fdir_counter_release(struct ice_pf *pf) > &fdir_info->counter; > uint8_t i; >=20 > - for (i =3D 0; i < container->index_free; i++) > + for (i =3D 0; i < container->index_free; i++) { > rte_free(container->pools[i]); > + container->pools[i] =3D NULL; > + } >=20 > TAILQ_INIT(&container->pool_list); > container->index_free =3D 0; > @@ -400,6 +407,9 @@ ice_fdir_release_filter_list(struct ice_pf *pf) > rte_free(fdir_info->hash_map); > if (fdir_info->hash_table) > rte_hash_free(fdir_info->hash_table); > + > + fdir_info->hash_map =3D NULL; > + fdir_info->hash_table =3D NULL; > } >=20 > /* > @@ -526,10 +536,13 @@ ice_fdir_prof_free(struct ice_hw *hw) >=20 > for (ptype =3D ICE_FLTR_PTYPE_NONF_NONE + 1; > ptype < ICE_FLTR_PTYPE_MAX; > - ptype++) > + ptype++) { > rte_free(hw->fdir_prof[ptype]); > + hw->fdir_prof[ptype] =3D NULL; > + } >=20 > rte_free(hw->fdir_prof); > + hw->fdir_prof =3D NULL; > } >=20 > /* Remove a profile for some filter type */ > -- > 2.17.1 Acked-by: Qiming Yang