Skip to content

Commit 3f4870d

Browse files
Dan Carpenteranguy11
authored andcommitted
ice: Fix off by one in ice_tc_forward_to_queue()
The > comparison should be >= to prevent reading one element beyond the end of the array. The "vsi->num_rxq" is not strictly speaking the number of elements in the vsi->rxq_map[] array. The array has "vsi->alloc_rxq" elements and "vsi->num_rxq" is less than or equal to the number of elements in the array. The array is allocated in ice_vsi_alloc_arrays(). It's still an off by one but it might not access outside the end of the array. Fixes: 143b86f ("ice: Enable RX queue selection using skbedit action") Signed-off-by: Dan Carpenter <[email protected]> Acked-by: Amritha Nambiar <[email protected]> Tested-by: Bharathi Sreenivas <[email protected]> Signed-off-by: Tony Nguyen <[email protected]> Reviewed-by: Leon Romanovsky <[email protected]>
1 parent c793f8e commit 3f4870d

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/net/ethernet/intel/ice/ice_tc_lib.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1681,7 +1681,7 @@ ice_tc_forward_to_queue(struct ice_vsi *vsi, struct ice_tc_flower_fltr *fltr,
16811681
struct ice_vsi *ch_vsi = NULL;
16821682
u16 queue = act->rx_queue;
16831683

1684-
if (queue > vsi->num_rxq) {
1684+
if (queue >= vsi->num_rxq) {
16851685
NL_SET_ERR_MSG_MOD(fltr->extack,
16861686
"Unable to add filter because specified queue is invalid");
16871687
return -EINVAL;

0 commit comments

Comments
 (0)