]> git.baikalelectronics.ru Git - kernel.git/commit
bpf: Check for integer overflow when using roundup_pow_of_two()
authorBui Quang Minh <minhquangbui99@gmail.com>
Wed, 27 Jan 2021 06:36:53 +0000 (06:36 +0000)
committerDaniel Borkmann <daniel@iogearbox.net>
Wed, 3 Feb 2021 20:45:33 +0000 (21:45 +0100)
commitfab86ed5bd48bc8dea04b598759732903859a091
treed30766fb02fcac1ed22476c75727435978cdee76
parentb2185f27b570eee2201886b5997e0ca1f72cab70
bpf: Check for integer overflow when using roundup_pow_of_two()

On 32-bit architecture, roundup_pow_of_two() can return 0 when the argument
has upper most bit set due to resulting 1UL << 32. Add a check for this case.

Fixes: bbb0755401a3 ("bpf: introduce BPF_MAP_TYPE_STACK_TRACE")
Signed-off-by: Bui Quang Minh <minhquangbui99@gmail.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Link: https://lore.kernel.org/bpf/20210127063653.3576-1-minhquangbui99@gmail.com
kernel/bpf/stackmap.c