ice: Fix off by one in ice_tc_forward_to_queue()
Subsystems (4)
PATCH 1/1 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.
---
Applies to net-next.
drivers/net/ethernet/intel/ice/ice_tc_lib.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/intel/ice/ice_tc_lib.c +1 -1
@@ -1681,7 +1681,7 @@ ice_tc_forward_to_queue(struct ice_vsi *vsi, struct ice_tc_flower_fltr *fltr,struct ice_vsi *ch_vsi =NULL ;u16 queue = act->rx_queue; -if (queue > vsi->num_rxq) { +if (queue >= vsi->num_rxq) {NL_SET_ERR_MSG_MOD (fltr->extack,"Unable to add filter because specified queue is invalid" );return -EINVAL ;
Signature · 6 lines
2.35.1 _______________________________________________ Intel-wired-lan mailing list [email protected] https://lists.osuosl.org/mailman/listinfo/intel-wired-lan
Quoted 16 lines
-----Original Message-----
From: Dan Carpenter <[email protected]>
Sent: Friday, October 28, 2022 8:02 AM
To: Brandeburg, Jesse <[email protected]>; Nambiar, Amritha <[email protected]>
Cc: Nguyen, Anthony L <[email protected]>; David S. Miller <[email protected]>; Eric Dumazet <[email protected]>; Jakub Kicinski <[email protected]>; Paolo Abeni <[email protected]>; Samudrala, Sridhar <[email protected]>; Gomes, Vinicius <[email protected]>; [email protected]; [email protected]; [email protected]
Subject: [PATCH net-next] ice: Fix off by one inice_tc_forward_to_queue()The > comparison should be >= to prevent reading one element beyond the end of the array.
Quoted 8 lines
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 inice_vsi_alloc_arrays(). It's still an off by one but it might not access outside the end of the array.Fixes 143b86f346c7 ("ice: Enable RX queue selection using skbedit action")Signed-off-by Dan Carpenter <[email protected]>
Quoted 24 lines
---
Applies to net-next.drivers/net/ethernet/intel/ice/ice_tc_lib.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/net/ethernet/intel/ice/ice_tc_lib.c +1
-1@@ -1681,7 +1681,7 @@ ice_tc_forward_to_queue(struct ice_vsi *vsi, structice_tc_flower_fltr *fltr, struct ice_vsi *ch_vsi = NULL;u16 queue = act->rx_queue; -if (queue > vsi->num_rxq) { +if (queue >= vsi->num_rxq) { NL_SET_ERR_MSG_MOD(fltr->extack, "Unable to add filter because specifiedqueue is invalid");
return-EINVAL;
--
2.35.1
Sreenivas, Bharathi
Tested-byQuoted 38 lines
-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Nambiar, Amritha
Sent: Saturday, October 29, 2022 2:58 AM
To: Dan Carpenter <[email protected]>; Brandeburg, Jesse <[email protected]>
Cc: [email protected]; Eric Dumazet <[email protected]>; [email protected]; intel-wired- [email protected]; Jakub Kicinski <[email protected]>; Paolo Abeni <[email protected]>; David S. Miller <[email protected]>
Subject: Re: [Intel-wired-lan] [PATCH net-next] ice: Fix off by one inice_tc_forward_to_queue()Quoted 23 lines
-----Original Message-----
From: Dan Carpenter <[email protected]>
Sent: Friday, October 28, 2022 8:02 AM
To: Brandeburg, Jesse <[email protected]>; Nambiar, Amritha <[email protected]>
Cc: Nguyen, Anthony L <[email protected]>; David S. Miller <[email protected]>; Eric Dumazet <[email protected]>; Jakub Kicinski <[email protected]>; Paolo Abeni <[email protected]>; Samudrala, Sridhar <[email protected]>; Gomes, Vinicius <[email protected]>; [email protected]; [email protected]; [email protected]
Subject: [PATCH net-next] ice: Fix off by one inice_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 inice_vsi_alloc_arrays(). It's still an off by one but it might not access outside the end of the array.
Quoted 12 lines
Quoted 3 lines
Fixes 143b86f346c7 ("ice: Enable RX queue selection using skbeditaction")
Signed-off-by Dan Carpenter <[email protected]>Acked-by Amritha Nambiar <[email protected]>Quoted 6 lines
---
Applies to net-next.drivers/net/ethernet/intel/ice/ice_tc_lib.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
_______________________________________________
Intel-wired-lan mailing list
[email protected]
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan