From 97671617ec36f45ea8600fe9b1d88cc4bf4bb12b Mon Sep 17 00:00:00 2001 From: Martin Weiser Date: Thu, 29 Oct 2020 12:25:42 +0100 Subject: [PATCH] net/af_xdp: fix integer overflow in umem size calculation The multiplication of two u32 integers may cause an overflow with large mempool sizes. Fixes: 74b46340e2d4 ("net/af_xdp: support shared UMEM") Signed-off-by: Martin Weiser Reviewed-by: Ferruh Yigit --- drivers/net/af_xdp/rte_eth_af_xdp.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/net/af_xdp/rte_eth_af_xdp.c b/drivers/net/af_xdp/rte_eth_af_xdp.c index df2767b81c..4076ff797c 100644 --- a/drivers/net/af_xdp/rte_eth_af_xdp.c +++ b/drivers/net/af_xdp/rte_eth_af_xdp.c @@ -968,7 +968,8 @@ xsk_umem_info *xdp_umem_configure(struct pmd_internals *internals, umem->mb_pool = mb_pool; base_addr = (void *)get_base_addr(mb_pool, &align); - umem_size = mb_pool->populated_size * usr_config.frame_size + + umem_size = (uint64_t)mb_pool->populated_size * + (uint64_t)usr_config.frame_size + align; ret = xsk_umem__create(&umem->umem, base_addr, umem_size, -- 2.20.1