From 2e3ddb568044308b40f60fdb2ddc62160b95b1b1 Mon Sep 17 00:00:00 2001 From: Sivaramakrishnan Venkat Date: Thu, 1 Feb 2024 15:50:20 +0000 Subject: [PATCH] drivers/net: fix buffer overflow for packet types list Address Sanitizer detects a buffer overflow caused by an incorrect ptypes list. Missing "RTE_PTYPE_UNKNOWN" ptype causes buffer overflow. Fix the ptypes list for drivers. Fixes: 0849ac3b6122 ("net/tap: add packet type management") Fixes: a7bdc3bd4244 ("net/dpaa: support packet type parsing") Fixes: 4ccc8d770d3b ("net/mvneta: add PMD skeleton") Fixes: f3f0d77db6b0 ("net/mrvl: support packet type parsing") Fixes: 71e8bb65046e ("net/nfp: update supported list of packet types") Fixes: 659b494d3d88 ("net/pfe: add packet types and basic statistics") Fixes: 398a1be14168 ("net/thunderx: remove generic passX references") Cc: stable@dpdk.org Signed-off-by: Sivaramakrishnan Venkat Reviewed-by: Ferruh Yigit --- drivers/net/dpaa/dpaa_ethdev.c | 3 ++- drivers/net/mvneta/mvneta_ethdev.c | 3 ++- drivers/net/mvpp2/mrvl_ethdev.c | 3 ++- drivers/net/nfp/nfp_net_common.c | 1 + drivers/net/pfe/pfe_ethdev.c | 3 ++- drivers/net/tap/rte_eth_tap.c | 1 + drivers/net/thunderx/nicvf_ethdev.c | 2 ++ 7 files changed, 12 insertions(+), 4 deletions(-) diff --git a/drivers/net/dpaa/dpaa_ethdev.c b/drivers/net/dpaa/dpaa_ethdev.c index bb2de5de801..cf73f9d50b9 100644 --- a/drivers/net/dpaa/dpaa_ethdev.c +++ b/drivers/net/dpaa/dpaa_ethdev.c @@ -363,7 +363,8 @@ dpaa_supported_ptypes_get(struct rte_eth_dev *dev) RTE_PTYPE_L4_TCP, RTE_PTYPE_L4_UDP, RTE_PTYPE_L4_SCTP, - RTE_PTYPE_TUNNEL_ESP + RTE_PTYPE_TUNNEL_ESP, + RTE_PTYPE_UNKNOWN }; PMD_INIT_FUNC_TRACE(); diff --git a/drivers/net/mvneta/mvneta_ethdev.c b/drivers/net/mvneta/mvneta_ethdev.c index daa69e533ad..212c300c148 100644 --- a/drivers/net/mvneta/mvneta_ethdev.c +++ b/drivers/net/mvneta/mvneta_ethdev.c @@ -198,7 +198,8 @@ mvneta_dev_supported_ptypes_get(struct rte_eth_dev *dev __rte_unused) RTE_PTYPE_L3_IPV4, RTE_PTYPE_L3_IPV6, RTE_PTYPE_L4_TCP, - RTE_PTYPE_L4_UDP + RTE_PTYPE_L4_UDP, + RTE_PTYPE_UNKNOWN }; return ptypes; diff --git a/drivers/net/mvpp2/mrvl_ethdev.c b/drivers/net/mvpp2/mrvl_ethdev.c index a91509d92af..82cb8d53684 100644 --- a/drivers/net/mvpp2/mrvl_ethdev.c +++ b/drivers/net/mvpp2/mrvl_ethdev.c @@ -1777,7 +1777,8 @@ mrvl_dev_supported_ptypes_get(struct rte_eth_dev *dev __rte_unused) RTE_PTYPE_L3_IPV6_EXT, RTE_PTYPE_L2_ETHER_ARP, RTE_PTYPE_L4_TCP, - RTE_PTYPE_L4_UDP + RTE_PTYPE_L4_UDP, + RTE_PTYPE_UNKNOWN }; return ptypes; diff --git a/drivers/net/nfp/nfp_net_common.c b/drivers/net/nfp/nfp_net_common.c index a438eb58714..c907d9d5f69 100644 --- a/drivers/net/nfp/nfp_net_common.c +++ b/drivers/net/nfp/nfp_net_common.c @@ -1365,6 +1365,7 @@ nfp_net_supported_ptypes_get(struct rte_eth_dev *dev) RTE_PTYPE_INNER_L4_NONFRAG, RTE_PTYPE_INNER_L4_ICMP, RTE_PTYPE_INNER_L4_SCTP, + RTE_PTYPE_UNKNOWN }; if (dev->rx_pkt_burst != nfp_net_recv_pkts) diff --git a/drivers/net/pfe/pfe_ethdev.c b/drivers/net/pfe/pfe_ethdev.c index 551f3cf193e..0073dd7405e 100644 --- a/drivers/net/pfe/pfe_ethdev.c +++ b/drivers/net/pfe/pfe_ethdev.c @@ -520,7 +520,8 @@ pfe_supported_ptypes_get(struct rte_eth_dev *dev) RTE_PTYPE_L3_IPV6_EXT, RTE_PTYPE_L4_TCP, RTE_PTYPE_L4_UDP, - RTE_PTYPE_L4_SCTP + RTE_PTYPE_L4_SCTP, + RTE_PTYPE_UNKNOWN }; if (dev->rx_pkt_burst == pfe_recv_pkts || diff --git a/drivers/net/tap/rte_eth_tap.c b/drivers/net/tap/rte_eth_tap.c index b41fa971cb7..3fa03cdbee8 100644 --- a/drivers/net/tap/rte_eth_tap.c +++ b/drivers/net/tap/rte_eth_tap.c @@ -1803,6 +1803,7 @@ tap_dev_supported_ptypes_get(struct rte_eth_dev *dev __rte_unused) RTE_PTYPE_L4_UDP, RTE_PTYPE_L4_TCP, RTE_PTYPE_L4_SCTP, + RTE_PTYPE_UNKNOWN }; return ptypes; diff --git a/drivers/net/thunderx/nicvf_ethdev.c b/drivers/net/thunderx/nicvf_ethdev.c index a504d41dfe6..5a0c3dc4a69 100644 --- a/drivers/net/thunderx/nicvf_ethdev.c +++ b/drivers/net/thunderx/nicvf_ethdev.c @@ -392,12 +392,14 @@ nicvf_dev_supported_ptypes_get(struct rte_eth_dev *dev) RTE_PTYPE_L4_TCP, RTE_PTYPE_L4_UDP, RTE_PTYPE_L4_FRAG, + RTE_PTYPE_UNKNOWN }; static const uint32_t ptypes_tunnel[] = { RTE_PTYPE_TUNNEL_GRE, RTE_PTYPE_TUNNEL_GENEVE, RTE_PTYPE_TUNNEL_VXLAN, RTE_PTYPE_TUNNEL_NVGRE, + RTE_PTYPE_UNKNOWN }; static const uint32_t ptypes_end = RTE_PTYPE_UNKNOWN;