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 02DC1A056D; Tue, 3 Mar 2020 06:07:42 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 8BD1F1BFF2; Tue, 3 Mar 2020 06:07:42 +0100 (CET) Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by dpdk.org (Postfix) with ESMTP id 872061BFF0; Tue, 3 Mar 2020 06:07:40 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 02 Mar 2020 21:07:39 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.70,510,1574150400"; d="scan'208";a="233637641" Received: from fmsmsx107.amr.corp.intel.com ([10.18.124.205]) by fmsmga008.fm.intel.com with ESMTP; 02 Mar 2020 21:07:39 -0800 Received: from fmsmsx111.amr.corp.intel.com (10.18.116.5) by fmsmsx107.amr.corp.intel.com (10.18.124.205) with Microsoft SMTP Server (TLS) id 14.3.439.0; Mon, 2 Mar 2020 21:07:38 -0800 Received: from shsmsx106.ccr.corp.intel.com (10.239.4.159) by fmsmsx111.amr.corp.intel.com (10.18.116.5) with Microsoft SMTP Server (TLS) id 14.3.439.0; Mon, 2 Mar 2020 21:07:37 -0800 Received: from shsmsx103.ccr.corp.intel.com ([169.254.4.137]) by SHSMSX106.ccr.corp.intel.com ([169.254.10.86]) with mapi id 14.03.0439.000; Tue, 3 Mar 2020 13:07:36 +0800 From: "Zhu, TaoX" To: "Ye, Xiaolong" CC: "Yang, Qiming" , "Lu, Wenzhuo" , "dev@dpdk.org" , "Su, Simei" , "Cao, Yahui" , "stable@dpdk.org" Thread-Topic: [DPDK] net/ice: fix hash flow segmentation fault Thread-Index: AQHV8QAhKYCX+10GHEGqTb5fjx0RTKg1sIMAgACaSdA= Date: Tue, 3 Mar 2020 05:07:35 +0000 Message-ID: <60652C6914E08D41B9AA1580751B3CA9015E285E@SHSMSX103.ccr.corp.intel.com> References: <20200303015557.63621-1-taox.zhu@intel.com> <20200303033206.GF25927@intel.com> In-Reply-To: <20200303033206.GF25927@intel.com> Accept-Language: zh-CN, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: 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] [DPDK] net/ice: fix hash flow segmentation fault 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 Xiaolong, Commit SHA length non-compliance will be modified in V2 patch. The reason why they did not return immediately after the error is that they= need to release the allocated memory after the error, which is released un= iformly in error processing, so they did not return directly. BR, Zhu, Tao > -----Original Message----- > From: Ye, Xiaolong > Sent: Tuesday, March 3, 2020 11:32 AM > To: Zhu, TaoX > Cc: Yang, Qiming ; Lu, Wenzhuo > ; dev@dpdk.org; Su, Simei ; > Cao, Yahui ; stable@dpdk.org > Subject: Re: [DPDK] net/ice: fix hash flow segmentation fault >=20 > On 03/03, taox.zhu@intel.com wrote: > >From: Zhu Tao > > > >Macro rte_errno is not a static value, so it needs to be updated in all > >error handling code. > > > >Patch 'dc36bd5dfd' mistakenly consider that rte_errno is a constant, > >which causes the unrecognized flow rule to be marked as recognition > success. > >Later, when the code tried to parse the flow rule, a null pointer > >caused a segmentation fault. > > > >Fixes: dc36bd5dfd ("net/ice: fix flow FDIR/switch memory leak") >=20 > It's recommended to have 12 chars length of commit SHA in Fixes line. > You can set below git alias for convenience. >=20 > git config alias.fixline "log -1 --abbrev=3D12 --format=3D'Fixes: %h > (\"%s\")%nCc: %ae'" >=20 > >Cc: stable@dpdk.org > > > >Signed-off-by: Zhu Tao > >--- > > drivers/net/ice/ice_hash.c | 14 ++++++++++---- > > 1 file changed, 10 insertions(+), 4 deletions(-) > > > >diff --git a/drivers/net/ice/ice_hash.c b/drivers/net/ice/ice_hash.c > >index d891538bd..e5fb0f344 100644 > >--- a/drivers/net/ice/ice_hash.c > >+++ b/drivers/net/ice/ice_hash.c > >@@ -409,7 +409,7 @@ ice_hash_parse_pattern_action(__rte_unused > struct ice_adapter *ad, > > void **meta, > > struct rte_flow_error *error) > > { > >- int ret =3D -rte_errno; > >+ int ret =3D 0; > > struct ice_pattern_match_item *pattern_match_item; > > struct rss_meta *rss_meta_ptr; > > > >@@ -424,12 +424,16 @@ ice_hash_parse_pattern_action(__rte_unused > struct ice_adapter *ad, > > /* Check rss supported pattern and find matched pattern. */ > > pattern_match_item =3D ice_search_pattern_match_item(pattern, > > array, array_len, error); > >- if (!pattern_match_item) > >+ if (!pattern_match_item) { > >+ ret =3D -rte_errno; > > goto error; > >+ } > > > > ret =3D ice_hash_check_inset(pattern, error); > >- if (ret) > >+ if (ret) { > >+ ret =3D -rte_errno; >=20 > This seems redundant, since ice_hash_check_inset would return -rte_errno > directly. >=20 > > goto error; > >+ } > > > > /* Save protocol header to rss_meta. */ > > *meta =3D rss_meta_ptr; > >@@ -439,8 +443,10 @@ ice_hash_parse_pattern_action(__rte_unused > struct ice_adapter *ad, > > /* Check rss action. */ > > ret =3D ice_hash_parse_action(pattern_match_item, actions, meta, > >error); > > error: > >- if (ret) > >+ if (ret) { > >+ ret =3D -rte_errno; >=20 > Ditto. >=20 > > rte_free(rss_meta_ptr); > >+ } > > rte_free(pattern_match_item); > > > > return ret; > >-- > >2.17.1 > >