Skip to content
Commit 61372543 authored by Bui Quang Minh's avatar Bui Quang Minh Committed by Greg Kroah-Hartman
Browse files

bpf: Fix integer overflow in argument calculation for bpf_map_area_alloc

commit 7dd5d437 upstream.

In 32-bit architecture, the result of sizeof() is a 32-bit integer so
the expression becomes the multiplication between 2 32-bit integer which
can potentially leads to integer overflow. As a result,
bpf_map_area_alloc() allocates less memory than needed.

Fix this by casting 1 operand to u64.

Fixes: 0d2c4f96 ("bpf: Eliminate rlimit-based memory accounting for sockmap and sockhash maps")
Fixes: 99c51064 ("devmap: Use bpf_map_area_alloc() for allocating hash buckets")
Fixes: 546ac1ff

 ("bpf: add devmap, a map for storing net device references")
Signed-off-by: default avatarBui Quang Minh <minhquangbui99@gmail.com>
Signed-off-by: default avatarAlexei Starovoitov <ast@kernel.org>
Link: https://lore.kernel.org/bpf/20210613143440.71975-1-minhquangbui99@gmail.com


Signed-off-by: default avatarConnor O'Brien <connoro@google.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 9099f351
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment