提交 067d59fd 编写于 作者: N Namhyung Kim 提交者: Zheng Zengkai

libbpf: Fix error path in bpf_object__elf_init()

stable inclusion
from stable-5.10.27
commit 86e525bc04f24d503cc6178d19f61b51727e6e91
bugzilla: 51493

--------------------------------

[ Upstream commit 8f3f5792 ]

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: NNamhyung Kim <namhyung@kernel.org>
Signed-off-by: NDaniel Borkmann <daniel@iogearbox.net>
Link: https://lore.kernel.org/bpf/20210317145414.884817-1-namhyung@kernel.orgSigned-off-by: NSasha Levin <sashal@kernel.org>
Signed-off-by: NChen Jun <chenjun102@huawei.com>
Acked-by: N  Weilong Chen <chenweilong@huawei.com>
Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
上级 89d7de49
...@@ -1162,7 +1162,8 @@ static int bpf_object__elf_init(struct bpf_object *obj) ...@@ -1162,7 +1162,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% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册