diff options
author | Gavrilov Ilia <Ilia.Gavrilov@infotecs.ru> | 2025-03-13 08:50:08 +0000 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2025-03-28 22:04:56 +0100 |
commit | c7670c197b0f1a8726ad5c87bc2bf001a1fc1bbd (patch) | |
tree | 85f825d4ab74dba3d01c82d80acc2d7ab1439263 /net | |
parent | f6a3cf833188e897c97028cd7b926e3f2cb1a8c0 (diff) | |
download | linux-c7670c197b0f1a8726ad5c87bc2bf001a1fc1bbd.tar.gz linux-c7670c197b0f1a8726ad5c87bc2bf001a1fc1bbd.tar.bz2 linux-c7670c197b0f1a8726ad5c87bc2bf001a1fc1bbd.zip |
xsk: fix an integer overflow in xp_create_and_assign_umem()
commit 559847f56769037e5b2e0474d3dbff985b98083d upstream.
Since the i and pool->chunk_size variables are of type 'u32',
their product can wrap around and then be cast to 'u64'.
This can lead to two different XDP buffers pointing to the same
memory area.
Found by InfoTeCS on behalf of Linux Verification Center
(linuxtesting.org) with SVACE.
Fixes: 94033cd8e73b ("xsk: Optimize for aligned case")
Cc: stable@vger.kernel.org
Signed-off-by: Ilia Gavrilov <Ilia.Gavrilov@infotecs.ru>
Link: https://patch.msgid.link/20250313085007.3116044-1-Ilia.Gavrilov@infotecs.ru
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'net')
-rw-r--r-- | net/xdp/xsk_buff_pool.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/net/xdp/xsk_buff_pool.c b/net/xdp/xsk_buff_pool.c index 1f7975b49657..d158cb6dd391 100644 --- a/net/xdp/xsk_buff_pool.c +++ b/net/xdp/xsk_buff_pool.c @@ -105,7 +105,7 @@ struct xsk_buff_pool *xp_create_and_assign_umem(struct xdp_sock *xs, if (pool->unaligned) pool->free_heads[i] = xskb; else - xp_init_xskb_addr(xskb, pool, i * pool->chunk_size); + xp_init_xskb_addr(xskb, pool, (u64)i * pool->chunk_size); } return pool; |