Commit 8f3f5792 authored by Namhyung Kim's avatar Namhyung Kim Committed by Daniel Borkmann

libbpf: Fix error path in bpf_object__elf_init()

When it failed to get section names, it should call into
bpf_object__elf_finish() like others.

Fixes: 88a82120 ("libbpf: Factor out common ELF operations and improve logging")
Signed-off-by: default avatarNamhyung Kim <namhyung@kernel.org>
Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
Link: https://lore.kernel.org/bpf/20210317145414.884817-1-namhyung@kernel.org
parent e21aa341
...@@ -1181,7 +1181,8 @@ static int bpf_object__elf_init(struct bpf_object *obj) ...@@ -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)) { 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", pr_warn("elf: failed to get section names strings from %s: %s\n",
obj->path, elf_errmsg(-1)); obj->path, elf_errmsg(-1));
return -LIBBPF_ERRNO__FORMAT; err = -LIBBPF_ERRNO__FORMAT;
goto errout;
} }
/* Old LLVM set e_machine to EM_NONE */ /* Old LLVM set e_machine to EM_NONE */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment