Skip to content

Commit 559847f

Browse files
Gavrilov IliaPaolo Abeni
authored andcommitted
xsk: fix an integer overflow in xp_create_and_assign_umem()
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: 94033cd ("xsk: Optimize for aligned case") Cc: [email protected] Signed-off-by: Ilia Gavrilov <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Paolo Abeni <[email protected]>
1 parent a0aff75 commit 559847f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

net/xdp/xsk_buff_pool.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ struct xsk_buff_pool *xp_create_and_assign_umem(struct xdp_sock *xs,
105105
if (pool->unaligned)
106106
pool->free_heads[i] = xskb;
107107
else
108-
xp_init_xskb_addr(xskb, pool, i * pool->chunk_size);
108+
xp_init_xskb_addr(xskb, pool, (u64)i * pool->chunk_size);
109109
}
110110

111111
return pool;

0 commit comments

Comments
 (0)