patches for DPDK stable branches
 help / color / mirror / Atom feed
* [dpdk-stable] [DPDK 01/46] net/ice/base: fix uninitialized stack variables
@ 2020-03-10 10:12 wei zhao
  2020-03-10 10:12 ` [dpdk-stable] [DPDK 03/46] net/ice/base: fix removing MAC rule wei zhao
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: wei zhao @ 2020-03-10 10:12 UTC (permalink / raw)
  To: qabuild; +Cc: Qi Zhang, stable, Jesse Brandeburg, Paul M Stillwell Jr

From: Qi Zhang <qi.z.zhang@intel.com>

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 <jesse.brandeburg@intel.com>
Signed-off-by: Paul M Stillwell Jr <paul.m.stillwell.jr@intel.com>
Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
---
 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 085f344..e88d0f7 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.7.5


^ permalink raw reply	[flat|nested] 6+ messages in thread
* [dpdk-stable] [DPDK 01/46] net/ice/base: fix uninitialized stack variables
@ 2020-03-10 10:26 wei zhao
  2020-03-10 10:27 ` [dpdk-stable] [DPDK 44/46] net/ice: change default tunnle type wei zhao
  0 siblings, 1 reply; 6+ messages in thread
From: wei zhao @ 2020-03-10 10:26 UTC (permalink / raw)
  To: qabuild; +Cc: wei zhao, stable, Jesse Brandeburg, Paul M Stillwell Jr, Qi Zhang

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 <jesse.brandeburg@intel.com>
Signed-off-by: Paul M Stillwell Jr <paul.m.stillwell.jr@intel.com>
Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
---
 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 085f344..e88d0f7 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.7.5


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2020-03-10 10:48 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-10 10:12 [dpdk-stable] [DPDK 01/46] net/ice/base: fix uninitialized stack variables wei zhao
2020-03-10 10:12 ` [dpdk-stable] [DPDK 03/46] net/ice/base: fix removing MAC rule wei zhao
2020-03-10 10:13 ` [dpdk-stable] [DPDK 44/46] net/ice: change default tunnle type wei zhao
2020-03-10 10:13 ` [dpdk-stable] [DPDK 45/46] net/ice: add action number check for swicth wei zhao
2020-03-10 10:13 ` [dpdk-stable] [DPDK 46/46] net/ice: fix input set of VLAN item wei zhao
2020-03-10 10:26 [dpdk-stable] [DPDK 01/46] net/ice/base: fix uninitialized stack variables wei zhao
2020-03-10 10:27 ` [dpdk-stable] [DPDK 44/46] net/ice: change default tunnle type wei zhao

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).