[v1] net/ice/base: fix wrong first mask value setting

Message ID 20210621085923.1286701-1-wenjun1.wu@intel.com (mailing list archive)
State Accepted, archived
Delegated to: Qi Zhang
Headers
Series [v1] net/ice/base: fix wrong first mask value setting |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/github-robot success github build: passed
ci/Intel-compilation success Compilation OK
ci/intel-Testing success Testing PASS
ci/iol-abi-testing success Testing PASS
ci/iol-testing success Testing PASS
ci/iol-intel-Functional fail Functional Testing issues
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-mellanox-Functional fail Functional Testing issues

Commit Message

Wenjun Wu June 21, 2021, 8:59 a.m. UTC
  Since each pf does not share the same structure space, the first
mask value should start at 0 instead of hw->pf_id * per_pf to avoid
address overflow. Otherwise, address space will overlap when
masks.first + masks.count > ICE_PROF_MASK_COUNT, and it may lead to
unexpected variable assignment, which causes segmentation fault.

Fixes: 9467486f179f ("net/ice/base: enable masking for RSS and FD field vectors")
Cc: stable@dpdk.org

Signed-off-by: Wenjun Wu <wenjun1.wu@intel.com>
---
 drivers/net/ice/base/ice_flex_pipe.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Comments

Qi Zhang June 29, 2021, 2:06 p.m. UTC | #1
> -----Original Message-----
> From: Wu, Wenjun1 <wenjun1.wu@intel.com>
> Sent: Monday, June 21, 2021 4:59 PM
> To: dev@dpdk.org; Yang, Qiming <qiming.yang@intel.com>; Zhang, Qi Z
> <qi.z.zhang@intel.com>
> Cc: Wu, Wenjun1 <wenjun1.wu@intel.com>; stable@dpdk.org
> Subject: [PATCH v1] net/ice/base: fix wrong first mask value setting
> 
> Since each pf does not share the same structure space, the first mask value
> should start at 0 instead of hw->pf_id * per_pf to avoid address overflow.
> Otherwise, address space will overlap when masks.first + masks.count >
> ICE_PROF_MASK_COUNT, and it may lead to unexpected variable assignment,
> which causes segmentation fault.
> 
> Fixes: 9467486f179f ("net/ice/base: enable masking for RSS and FD field
> vectors")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Wenjun Wu <wenjun1.wu@intel.com>

Acked-by: Qi Zhang <qi.z.zhang@intel.com>

Applied to dpdk-next-net-intel.

Thanks
Qi
  

Patch

diff --git a/drivers/net/ice/base/ice_flex_pipe.c b/drivers/net/ice/base/ice_flex_pipe.c
index fabff039ec..aa42177833 100644
--- a/drivers/net/ice/base/ice_flex_pipe.c
+++ b/drivers/net/ice/base/ice_flex_pipe.c
@@ -3435,7 +3435,7 @@  static void ice_init_prof_masks(struct ice_hw *hw, enum ice_block blk)
 	per_pf = ICE_PROF_MASK_COUNT / hw->dev_caps.num_funcs;
 
 	hw->blk[blk].masks.count = per_pf;
-	hw->blk[blk].masks.first = hw->pf_id * per_pf;
+	hw->blk[blk].masks.first = 0;
 
 	ice_memset(hw->blk[blk].masks.masks, 0,
 		   sizeof(hw->blk[blk].masks.masks), ICE_NONDMA_MEM);