net/octeontx2: fix ptype get overflow

Message ID 20190814094114.882-1-pbhagavatula@marvell.com (mailing list archive)
State Accepted, archived
Delegated to: Jerin Jacob
Headers
Series net/octeontx2: fix ptype get overflow |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK
ci/iol-Compile-Testing success Compile Testing PASS
ci/intel-Performance-Testing success Performance Testing PASS
ci/mellanox-Performance-Testing success Performance Testing PASS

Commit Message

Pavan Nikhilesh Bhagavatula Aug. 14, 2019, 9:41 a.m. UTC
  From: Pavan Nikhilesh <pbhagavatula@marvell.com>

The function `rte_eth_dev_get_supported_ptypes` expects the underlying
ethernet device to return array of supported ptypes. The ethernet device
needs to set `RTE_PTYPE_UNKNOWN` as the last element which signifies
thats its the end of the ptype array.
Else the function `rte_eth_dev_get_supported_ptypes` might overflow.

Fixes: 6e892eabce11 ("net/octeontx2: support packet type")

Signed-off-by: Pavan Nikhilesh <pbhagavatula@marvell.com>
---
 drivers/net/octeontx2/otx2_lookup.c | 1 +
 1 file changed, 1 insertion(+)
  

Comments

Jerin Jacob Sept. 13, 2019, 2:10 p.m. UTC | #1
On Wed, Aug 14, 2019 at 3:11 PM <pbhagavatula@marvell.com> wrote:
>
> From: Pavan Nikhilesh <pbhagavatula@marvell.com>
>
> The function `rte_eth_dev_get_supported_ptypes` expects the underlying
> ethernet device to return array of supported ptypes. The ethernet device
> needs to set `RTE_PTYPE_UNKNOWN` as the last element which signifies
> thats its the end of the ptype array.
> Else the function `rte_eth_dev_get_supported_ptypes` might overflow.
>

Cc: stable@dpdk.org

> Fixes: 6e892eabce11 ("net/octeontx2: support packet type")
>
> Signed-off-by: Pavan Nikhilesh <pbhagavatula@marvell.com>

Acked-by: Jerin Jacob <jerinj@marvell.com>


> ---
>  drivers/net/octeontx2/otx2_lookup.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/drivers/net/octeontx2/otx2_lookup.c b/drivers/net/octeontx2/otx2_lookup.c
> index 99199d08a..3347e7014 100644
> --- a/drivers/net/octeontx2/otx2_lookup.c
> +++ b/drivers/net/octeontx2/otx2_lookup.c
> @@ -53,6 +53,7 @@ otx2_nix_supported_ptypes_get(struct rte_eth_dev *eth_dev)
>                 RTE_PTYPE_INNER_L4_UDP,  /* LH */
>                 RTE_PTYPE_INNER_L4_SCTP, /* LH */
>                 RTE_PTYPE_INNER_L4_ICMP, /* LH */
> +               RTE_PTYPE_UNKNOWN,
>         };
>
>         if (dev->rx_offload_flags & NIX_RX_OFFLOAD_PTYPE_F)
> --
> 2.17.1
>
  
Jerin Jacob Sept. 23, 2019, 7:48 a.m. UTC | #2
On Fri, Sep 13, 2019 at 7:40 PM Jerin Jacob <jerinjacobk@gmail.com> wrote:
>
> On Wed, Aug 14, 2019 at 3:11 PM <pbhagavatula@marvell.com> wrote:
> >
> > From: Pavan Nikhilesh <pbhagavatula@marvell.com>
> >
> > The function `rte_eth_dev_get_supported_ptypes` expects the underlying
> > ethernet device to return array of supported ptypes. The ethernet device
> > needs to set `RTE_PTYPE_UNKNOWN` as the last element which signifies
> > thats its the end of the ptype array.
> > Else the function `rte_eth_dev_get_supported_ptypes` might overflow.
> >
>
> Cc: stable@dpdk.org
>
> > Fixes: 6e892eabce11 ("net/octeontx2: support packet type")
> >
> > Signed-off-by: Pavan Nikhilesh <pbhagavatula@marvell.com>
>
> Acked-by: Jerin Jacob <jerinj@marvell.com>

Applied to dpdk-next-net-mrvl/master. Thanks


>
>
> > ---
> >  drivers/net/octeontx2/otx2_lookup.c | 1 +
> >  1 file changed, 1 insertion(+)
> >
> > diff --git a/drivers/net/octeontx2/otx2_lookup.c b/drivers/net/octeontx2/otx2_lookup.c
> > index 99199d08a..3347e7014 100644
> > --- a/drivers/net/octeontx2/otx2_lookup.c
> > +++ b/drivers/net/octeontx2/otx2_lookup.c
> > @@ -53,6 +53,7 @@ otx2_nix_supported_ptypes_get(struct rte_eth_dev *eth_dev)
> >                 RTE_PTYPE_INNER_L4_UDP,  /* LH */
> >                 RTE_PTYPE_INNER_L4_SCTP, /* LH */
> >                 RTE_PTYPE_INNER_L4_ICMP, /* LH */
> > +               RTE_PTYPE_UNKNOWN,
> >         };
> >
> >         if (dev->rx_offload_flags & NIX_RX_OFFLOAD_PTYPE_F)
> > --
> > 2.17.1
> >
  

Patch

diff --git a/drivers/net/octeontx2/otx2_lookup.c b/drivers/net/octeontx2/otx2_lookup.c
index 99199d08a..3347e7014 100644
--- a/drivers/net/octeontx2/otx2_lookup.c
+++ b/drivers/net/octeontx2/otx2_lookup.c
@@ -53,6 +53,7 @@  otx2_nix_supported_ptypes_get(struct rte_eth_dev *eth_dev)
 		RTE_PTYPE_INNER_L4_UDP,  /* LH */
 		RTE_PTYPE_INNER_L4_SCTP, /* LH */
 		RTE_PTYPE_INNER_L4_ICMP, /* LH */
+		RTE_PTYPE_UNKNOWN,
 	};
 
 	if (dev->rx_offload_flags & NIX_RX_OFFLOAD_PTYPE_F)