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 DF7A6A0564 for ; Mon, 23 Mar 2020 08:14:40 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 7CEFD1C037; Mon, 23 Mar 2020 08:14:40 +0100 (CET) Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by dpdk.org (Postfix) with ESMTP id 24E4F3B5; Mon, 23 Mar 2020 08:14:35 +0100 (CET) IronPort-SDR: ih1kzAU65rlZ78bEemMdSmiirJizDvksuyogsM28AlDcxS9CJDDCQ86tyM7xshyKTKx20FpmjU p5JRHDsY3ffQ== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Mar 2020 00:14:34 -0700 IronPort-SDR: gsWA/fXNXuNi1hvPc7VfY/Uv50DBr4/NXAFXO2C/uRj6VVQJiuGFDs+xQVQtcBtjGltlRq66za PKoyNHWLvKPQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.72,295,1580803200"; d="scan'208";a="246111473" Received: from dpdk51.sh.intel.com ([10.67.110.245]) by orsmga003.jf.intel.com with ESMTP; 23 Mar 2020 00:14:32 -0700 From: Qi Zhang To: qiming.yang@intel.com Cc: dev@dpdk.org, xiaolong.ye@intel.com, Qi Zhang , stable@dpdk.org, Jesse Brandeburg , Paul M Stillwell Jr Date: Mon, 23 Mar 2020 15:17:24 +0800 Message-Id: <20200323071759.13075-2-qi.z.zhang@intel.com> X-Mailer: git-send-email 2.13.6 In-Reply-To: <20200323071759.13075-1-qi.z.zhang@intel.com> References: <20200309114357.31800-1-qi.z.zhang@intel.com> <20200323071759.13075-1-qi.z.zhang@intel.com> Subject: [dpdk-stable] [PATCH v2 01/36] net/ice/base: fix uninitialized stack variables X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Sender: "stable" Via code inspection, I found that some partially initialized stack variables were being passed along to called functions, which could eventually result in those uninitialized members being used. To fix this, make sure the local variables are zeroed out before partially initializing them. This should prevent any unintended consequences from using stack memory that might have junk in it. In addition to the memsets, this patch also initializes one member in one function, that needed to be initialized to non-zero. Fixes: fed0c5ca5f19 ("net/ice/base: support programming a new switch recipe") Cc: stable@dpdk.org Signed-off-by: Jesse Brandeburg Signed-off-by: Paul M Stillwell Jr Signed-off-by: Qi Zhang --- drivers/net/ice/base/ice_switch.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/net/ice/base/ice_switch.c b/drivers/net/ice/base/ice_switch.c index 085f34406..e88d0f7fe 100644 --- a/drivers/net/ice/base/ice_switch.c +++ b/drivers/net/ice/base/ice_switch.c @@ -6227,9 +6227,12 @@ ice_adv_add_update_vsi_list(struct ice_hw *hw, if (status) return status; + ice_memset(&tmp_fltr, 0, sizeof(tmp_fltr), ICE_NONDMA_MEM); tmp_fltr.fltr_rule_id = cur_fltr->fltr_rule_id; tmp_fltr.fltr_act = ICE_FWD_TO_VSI_LIST; tmp_fltr.fwd_id.vsi_list_id = vsi_list_id; + tmp_fltr.lkup_type = ICE_SW_LKUP_LAST; + /* Update the previous switch rule of "forward to VSI" to * "fwd to VSI list" */ @@ -6473,6 +6476,7 @@ ice_add_adv_rule(struct ice_hw *hw, struct ice_adv_lkup_elem *lkups, if (rinfo->sw_act.fltr_act == ICE_FWD_TO_VSI) { struct ice_fltr_info tmp_fltr; + ice_memset(&tmp_fltr, 0, sizeof(tmp_fltr), ICE_NONDMA_MEM); tmp_fltr.fltr_rule_id = LE16_TO_CPU(s_rule->pdata.lkup_tx_rx.index); tmp_fltr.fltr_act = ICE_FWD_TO_VSI; @@ -6557,6 +6561,8 @@ ice_adv_rem_update_vsi_list(struct ice_hw *hw, u16 vsi_handle, lkup_type); if (status) return status; + + ice_memset(&tmp_fltr, 0, sizeof(tmp_fltr), ICE_NONDMA_MEM); tmp_fltr.fltr_rule_id = fm_list->rule_info.fltr_rule_id; fm_list->rule_info.sw_act.fltr_act = ICE_FWD_TO_VSI; tmp_fltr.fltr_act = ICE_FWD_TO_VSI; -- 2.13.6