Skip to content

Commit

Permalink
drivers/net: fix buffer overflow for packet types list
Browse files Browse the repository at this point in the history
[ upstream commit 2e3ddb568044308b40f60fdb2ddc62160b95b1b1 ]

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: 0849ac3 ("net/tap: add packet type management")
Fixes: a7bdc3b ("net/dpaa: support packet type parsing")
Fixes: 4ccc8d7 ("net/mvneta: add PMD skeleton")
Fixes: f3f0d77 ("net/mrvl: support packet type parsing")
Fixes: 71e8bb65046e ("net/nfp: update supported list of packet types")
Fixes: 659b494 ("net/pfe: add packet types and basic statistics")
Fixes: 398a1be ("net/thunderx: remove generic passX references")

Signed-off-by: Sivaramakrishnan Venkat <venkatx.sivaramakrishnan@intel.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@amd.com>
  • Loading branch information
vsivar1x authored and bluca committed Mar 7, 2024
1 parent d327329 commit cf7a7b8
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 4 deletions.
3 changes: 2 additions & 1 deletion drivers/net/dpaa/dpaa_ethdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
3 changes: 2 additions & 1 deletion drivers/net/mvneta/mvneta_ethdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
3 changes: 2 additions & 1 deletion drivers/net/mvpp2/mrvl_ethdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
3 changes: 2 additions & 1 deletion drivers/net/pfe/pfe_ethdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 ||
Expand Down
1 change: 1 addition & 0 deletions drivers/net/tap/rte_eth_tap.c
Original file line number Diff line number Diff line change
Expand Up @@ -1862,6 +1862,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;
Expand Down
2 changes: 2 additions & 0 deletions drivers/net/thunderx/nicvf_ethdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down

0 comments on commit cf7a7b8

Please sign in to comment.