Skip to content

Commit 205649d

Browse files
Gavrilov Iliagregkh
authored andcommitted
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: 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]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent ccb4aef commit 205649d

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
@@ -102,7 +102,7 @@ struct xsk_buff_pool *xp_create_and_assign_umem(struct xdp_sock *xs,
102102
if (pool->unaligned)
103103
pool->free_heads[i] = xskb;
104104
else
105-
xp_init_xskb_addr(xskb, pool, i * pool->chunk_size);
105+
xp_init_xskb_addr(xskb, pool, (u64)i * pool->chunk_size);
106106
}
107107

108108
return pool;

0 commit comments

Comments
 (0)