projects
/
platform
/
kernel
/
linux-rpi.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
738a2f2
)
libbpf: Fix potential NULL dereference when parsing ELF
author
Andrii Nakryiko
<andrii@kernel.org>
Tue, 16 Aug 2022 00:19:26 +0000
(17:19 -0700)
committer
Daniel Borkmann
<daniel@iogearbox.net>
Wed, 17 Aug 2022 20:42:10 +0000
(22:42 +0200)
Fix if condition filtering empty ELF sections to prevent NULL
dereference.
Fixes:
47ea7417b074
("libbpf: Skip empty sections in bpf_object__init_global_data_maps")
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Hao Luo <haoluo@google.com>
Link:
https://lore.kernel.org/bpf/20220816001929.369487-2-andrii@kernel.org
tools/lib/bpf/libbpf.c
patch
|
blob
|
history
diff --git
a/tools/lib/bpf/libbpf.c
b/tools/lib/bpf/libbpf.c
index
0159a43
..
146d355
100644
(file)
--- a/
tools/lib/bpf/libbpf.c
+++ b/
tools/lib/bpf/libbpf.c
@@
-1649,7
+1649,7
@@
static int bpf_object__init_global_data_maps(struct bpf_object *obj)
sec_desc = &obj->efile.secs[sec_idx];
/* Skip recognized sections with size 0. */
- if (
sec_desc->data &&
sec_desc->data->d_size == 0)
+ if (
!sec_desc->data ||
sec_desc->data->d_size == 0)
continue;
switch (sec_desc->sec_type) {