mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-27 12:57:53 +00:00
libbpf: Fix potential NULL dereference when parsing ELF
Fix if condition filtering empty ELF sections to prevent NULL
dereference.
Fixes: 47ea7417b0
("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
This commit is contained in:
parent
738a2f2f91
commit
d4e6d684f3
1 changed files with 1 additions and 1 deletions
|
@ -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) {
|
||||
|
|
Loading…
Reference in a new issue