Skip to content

Commit

Permalink
libbpf: Fix error path in bpf_object__elf_init()
Browse files Browse the repository at this point in the history
When it failed to get section names, it should call into
bpf_object__elf_finish() like others.

Fixes: 88a8212 ("libbpf: Factor out common ELF operations and improve logging")
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Link: https://lore.kernel.org/bpf/20210317145414.884817-1-namhyung@kernel.org
  • Loading branch information
Namhyung Kim authored and Daniel Borkmann committed Mar 17, 2021
1 parent e21aa34 commit 8f3f579
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion tools/lib/bpf/libbpf.c
Original file line number Diff line number Diff line change
Expand Up @@ -1181,7 +1181,8 @@ static int bpf_object__elf_init(struct bpf_object *obj)
if (!elf_rawdata(elf_getscn(obj->efile.elf, obj->efile.shstrndx), NULL)) {
pr_warn("elf: failed to get section names strings from %s: %s\n",
obj->path, elf_errmsg(-1));
return -LIBBPF_ERRNO__FORMAT;
err = -LIBBPF_ERRNO__FORMAT;
goto errout;
}

/* Old LLVM set e_machine to EM_NONE */
Expand Down

0 comments on commit 8f3f579

Please sign in to comment.