All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net-next] ice: Fix off by one in ice_tc_forward_to_queue()
@ 2022-10-28 15:02 ` Dan Carpenter
  0 siblings, 0 replies; 5+ messages in thread
From: Dan Carpenter @ 2022-10-28 15:02 UTC (permalink / raw)
  To: Jesse Brandeburg, Amritha Nambiar
  Cc: Tony Nguyen, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, Sridhar Samudrala, Vinicius Costa Gomes,
	intel-wired-lan, netdev, kernel-janitors

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: 143b86f346c7 ("ice: Enable RX queue selection using skbedit action")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
Applies to net-next.

 drivers/net/ethernet/intel/ice/ice_tc_lib.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/intel/ice/ice_tc_lib.c b/drivers/net/ethernet/intel/ice/ice_tc_lib.c
index faba0f857cd9..95f392ab9670 100644
--- a/drivers/net/ethernet/intel/ice/ice_tc_lib.c
+++ b/drivers/net/ethernet/intel/ice/ice_tc_lib.c
@@ -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;
-- 
2.35.1


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

* [Intel-wired-lan] [PATCH net-next] ice: Fix off by one in ice_tc_forward_to_queue()
@ 2022-10-28 15:02 ` Dan Carpenter
  0 siblings, 0 replies; 5+ messages in thread
From: Dan Carpenter @ 2022-10-28 15:02 UTC (permalink / raw)
  To: Jesse Brandeburg, Amritha Nambiar
  Cc: kernel-janitors, Eric Dumazet, netdev, intel-wired-lan,
	Jakub Kicinski, Paolo Abeni, David S. Miller

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: 143b86f346c7 ("ice: Enable RX queue selection using skbedit action")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
Applies to net-next.

 drivers/net/ethernet/intel/ice/ice_tc_lib.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/intel/ice/ice_tc_lib.c b/drivers/net/ethernet/intel/ice/ice_tc_lib.c
index faba0f857cd9..95f392ab9670 100644
--- a/drivers/net/ethernet/intel/ice/ice_tc_lib.c
+++ b/drivers/net/ethernet/intel/ice/ice_tc_lib.c
@@ -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;
-- 
2.35.1

_______________________________________________
Intel-wired-lan mailing list
Intel-wired-lan@osuosl.org
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan

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

* RE: [PATCH net-next] ice: Fix off by one in ice_tc_forward_to_queue()
  2022-10-28 15:02 ` [Intel-wired-lan] " Dan Carpenter
@ 2022-10-28 21:27   ` Nambiar, Amritha
  -1 siblings, 0 replies; 5+ messages in thread
From: Nambiar, Amritha @ 2022-10-28 21:27 UTC (permalink / raw)
  To: Dan Carpenter, Brandeburg, Jesse
  Cc: Nguyen, Anthony L, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, Samudrala, Sridhar, Gomes, Vinicius,
	intel-wired-lan, netdev, kernel-janitors

> -----Original Message-----
> From: Dan Carpenter <dan.carpenter@oracle.com>
> Sent: Friday, October 28, 2022 8:02 AM
> To: Brandeburg, Jesse <jesse.brandeburg@intel.com>; Nambiar, Amritha
> <amritha.nambiar@intel.com>
> Cc: Nguyen, Anthony L <anthony.l.nguyen@intel.com>; David S. Miller
> <davem@davemloft.net>; Eric Dumazet <edumazet@google.com>; Jakub
> Kicinski <kuba@kernel.org>; Paolo Abeni <pabeni@redhat.com>; Samudrala,
> Sridhar <sridhar.samudrala@intel.com>; Gomes, Vinicius
> <vinicius.gomes@intel.com>; intel-wired-lan@lists.osuosl.org;
> netdev@vger.kernel.org; kernel-janitors@vger.kernel.org
> Subject: [PATCH net-next] 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: 143b86f346c7 ("ice: Enable RX queue selection using skbedit action")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Acked-by: Amritha Nambiar <amritha.nambiar@intel.com>

> ---
> Applies to net-next.
> 
>  drivers/net/ethernet/intel/ice/ice_tc_lib.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/net/ethernet/intel/ice/ice_tc_lib.c
> b/drivers/net/ethernet/intel/ice/ice_tc_lib.c
> index faba0f857cd9..95f392ab9670 100644
> --- a/drivers/net/ethernet/intel/ice/ice_tc_lib.c
> +++ b/drivers/net/ethernet/intel/ice/ice_tc_lib.c
> @@ -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;
> --
> 2.35.1


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

* Re: [Intel-wired-lan] [PATCH net-next] ice: Fix off by one in ice_tc_forward_to_queue()
@ 2022-10-28 21:27   ` Nambiar, Amritha
  0 siblings, 0 replies; 5+ messages in thread
From: Nambiar, Amritha @ 2022-10-28 21:27 UTC (permalink / raw)
  To: Dan Carpenter, Brandeburg, Jesse
  Cc: kernel-janitors, Eric Dumazet, netdev, intel-wired-lan,
	Jakub Kicinski, Paolo Abeni, David S. Miller

> -----Original Message-----
> From: Dan Carpenter <dan.carpenter@oracle.com>
> Sent: Friday, October 28, 2022 8:02 AM
> To: Brandeburg, Jesse <jesse.brandeburg@intel.com>; Nambiar, Amritha
> <amritha.nambiar@intel.com>
> Cc: Nguyen, Anthony L <anthony.l.nguyen@intel.com>; David S. Miller
> <davem@davemloft.net>; Eric Dumazet <edumazet@google.com>; Jakub
> Kicinski <kuba@kernel.org>; Paolo Abeni <pabeni@redhat.com>; Samudrala,
> Sridhar <sridhar.samudrala@intel.com>; Gomes, Vinicius
> <vinicius.gomes@intel.com>; intel-wired-lan@lists.osuosl.org;
> netdev@vger.kernel.org; kernel-janitors@vger.kernel.org
> Subject: [PATCH net-next] 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: 143b86f346c7 ("ice: Enable RX queue selection using skbedit action")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Acked-by: Amritha Nambiar <amritha.nambiar@intel.com>

> ---
> Applies to net-next.
> 
>  drivers/net/ethernet/intel/ice/ice_tc_lib.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/net/ethernet/intel/ice/ice_tc_lib.c
> b/drivers/net/ethernet/intel/ice/ice_tc_lib.c
> index faba0f857cd9..95f392ab9670 100644
> --- a/drivers/net/ethernet/intel/ice/ice_tc_lib.c
> +++ b/drivers/net/ethernet/intel/ice/ice_tc_lib.c
> @@ -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;
> --
> 2.35.1

_______________________________________________
Intel-wired-lan mailing list
Intel-wired-lan@osuosl.org
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan

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

* Re: [Intel-wired-lan] [PATCH net-next] ice: Fix off by one in ice_tc_forward_to_queue()
  2022-10-28 21:27   ` [Intel-wired-lan] " Nambiar, Amritha
  (?)
@ 2022-12-01 18:45   ` Sreenivas, Bharathi
  -1 siblings, 0 replies; 5+ messages in thread
From: Sreenivas, Bharathi @ 2022-12-01 18:45 UTC (permalink / raw)
  To: intel-wired-lan



> -----Original Message-----
> From: Intel-wired-lan <intel-wired-lan-bounces@osuosl.org> On Behalf Of
> Nambiar, Amritha
> Sent: Saturday, October 29, 2022 2:58 AM
> To: Dan Carpenter <dan.carpenter@oracle.com>; Brandeburg, Jesse
> <jesse.brandeburg@intel.com>
> Cc: kernel-janitors@vger.kernel.org; Eric Dumazet
> <edumazet@google.com>; netdev@vger.kernel.org; intel-wired-
> lan@lists.osuosl.org; Jakub Kicinski <kuba@kernel.org>; Paolo Abeni
> <pabeni@redhat.com>; David S. Miller <davem@davemloft.net>
> Subject: Re: [Intel-wired-lan] [PATCH net-next] ice: Fix off by one in
> ice_tc_forward_to_queue()
> 
> > -----Original Message-----
> > From: Dan Carpenter <dan.carpenter@oracle.com>
> > Sent: Friday, October 28, 2022 8:02 AM
> > To: Brandeburg, Jesse <jesse.brandeburg@intel.com>; Nambiar, Amritha
> > <amritha.nambiar@intel.com>
> > Cc: Nguyen, Anthony L <anthony.l.nguyen@intel.com>; David S. Miller
> > <davem@davemloft.net>; Eric Dumazet <edumazet@google.com>; Jakub
> > Kicinski <kuba@kernel.org>; Paolo Abeni <pabeni@redhat.com>;
> > Samudrala, Sridhar <sridhar.samudrala@intel.com>; Gomes, Vinicius
> > <vinicius.gomes@intel.com>; intel-wired-lan@lists.osuosl.org;
> > netdev@vger.kernel.org; kernel-janitors@vger.kernel.org
> > Subject: [PATCH net-next] 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: 143b86f346c7 ("ice: Enable RX queue selection using skbedit
> > action")
> > Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> 
> Acked-by: Amritha Nambiar <amritha.nambiar@intel.com>
> 
> > ---
> > Applies to net-next.
> >
> >  drivers/net/ethernet/intel/ice/ice_tc_lib.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
Tested-by: Bharathi Sreenivas <bharathi.sreenivas@intel.com>
_______________________________________________
Intel-wired-lan mailing list
Intel-wired-lan@osuosl.org
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan

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

end of thread, other threads:[~2022-12-01 18:45 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-28 15:02 [PATCH net-next] ice: Fix off by one in ice_tc_forward_to_queue() Dan Carpenter
2022-10-28 15:02 ` [Intel-wired-lan] " Dan Carpenter
2022-10-28 21:27 ` Nambiar, Amritha
2022-10-28 21:27   ` [Intel-wired-lan] " Nambiar, Amritha
2022-12-01 18:45   ` Sreenivas, Bharathi

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.