OpenCloudOS-Kernel/kernel/bpf
Alexei Starovoitov daaf427c6a bpf: fix arraymap NULL deref and missing overflow and zero size checks
- fix NULL pointer dereference:
kernel/bpf/arraymap.c:41 array_map_alloc() error: potential null dereference 'array'.  (kzalloc returns null)
kernel/bpf/arraymap.c:41 array_map_alloc() error: we previously assumed 'array' could be null (see line 40)

- integer overflow check was missing in arraymap
(hashmap checks for overflow via kmalloc_array())

- arraymap can round_up(value_size, 8) to zero. check was missing.

- hashmap was missing zero size check as well, since roundup_pow_of_two() can
truncate into zero

- found a typo in the arraymap comment and unnecessary empty line

Fix all of these issues and make both overflow checks explicit U32 in size.

Reported-by: kbuild test robot <fengguang.wu@intel.com>
Signed-off-by: Alexei Starovoitov <ast@plumgrid.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2014-11-19 15:40:00 -05:00
..
Makefile bpf: allow eBPF programs to use maps 2014-11-18 13:44:00 -05:00
arraymap.c bpf: fix arraymap NULL deref and missing overflow and zero size checks 2014-11-19 15:40:00 -05:00
core.c bpf: split eBPF out of NET 2014-10-27 19:09:59 -04:00
hashtab.c bpf: fix arraymap NULL deref and missing overflow and zero size checks 2014-11-19 15:40:00 -05:00
helpers.c bpf: allow eBPF programs to use maps 2014-11-18 13:44:00 -05:00
syscall.c bpf: fix BPF_MAP_LOOKUP_ELEM command return code 2014-11-18 13:43:59 -05:00
test_stub.c bpf: remove test map scaffolding and user proper types 2014-11-18 13:44:00 -05:00
verifier.c bpf: reduce verifier memory consumption 2014-10-30 15:44:37 -04:00