Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp3426100pxf; Mon, 29 Mar 2021 01:44:49 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyrXiSTrzfhmVCr/DbuXQ2VSmX/5rApysLZg8oY1Lg1nyAYU5jYdjrzVsnkJ40XgFjcgqan X-Received: by 2002:a05:6402:138f:: with SMTP id b15mr27560979edv.121.1617007488830; Mon, 29 Mar 2021 01:44:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617007488; cv=none; d=google.com; s=arc-20160816; b=qAsA+7+dNr6S7ex1LO4nxreMOsMK2BTHM7d/wflaxIqLrKw8f+Aii1pxZQ5ra5OlIX tkOqZh2Nb1ClPh/6RHwJJCFqg5y9maGP8KTuFUhJdntUVXsSusM6e8p8kCCB+p6ImLbs TJpZWnrRlHUNYgjMrU9mrl39uXT5v1ZyK7VkrLK40HpNmLRBeGhOAuXLrEOrybrP8D6M h6z1tom0W1dw3xheVhmyRzauMhMdFjXV8dE0Wojm1JUEwLB50i7xXFgLeEUENLsY82i8 otBFo082pLKp6bEFFK04X45bIFQIDECSdHboP1Ao9s5l09eDePSw9lFU12jYFE0AOtXz ipFA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=H7i8Jw5lsx4CNK+VJdQfKVNCFdBzWIV+TGdRFvF+aTg=; b=IhcWynf/tbv2/sl0br/YOrMhA5gArHWLhkgQC0P8fOR3kbxf/OW5F00RzLj+L4XHA6 C//c0rsGefy21ndcohFGaeU4gpZ/JA36oA95fGt5Rt31W1+dEquW916lrif6H5YcS8rC w9yK+f9g/SUZt/h/ZdJyrqaDdg7nh0xUUlbPrPPyxABgWVFiZuRRluw+LJj0aIZQiyHB Sb3csfrdcbB0WbGFnk8/xlqnPlW+DA5GxB+qfJKfeB61WMEry4Xu70TEEt1p/vaOy1G4 EVR7iX7Ktz3ovbQAooD3ks9T4SOprPGhZjXYESYG80XPpiyXXzjCw3z6dG4l7k2Vp392 dWXw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=SMbWBP5A; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id e15si12335502edz.11.2021.03.29.01.44.26; Mon, 29 Mar 2021 01:44:48 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=SMbWBP5A; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235432AbhC2Imx (ORCPT + 99 others); Mon, 29 Mar 2021 04:42:53 -0400 Received: from mail.kernel.org ([198.145.29.99]:41376 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232503AbhC2IYe (ORCPT ); Mon, 29 Mar 2021 04:24:34 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id A9FD56196F; Mon, 29 Mar 2021 08:24:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1617006274; bh=4f1Ps+4rjDBimtcdCio9qz+OSNwK5wlcNv1Zn//1gik=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SMbWBP5AEWqJuaykwPQmSVXDHpnN/QFqHCrhSYJrujHVDY7bCTp2vK28+3sVoRvoh 56C4anGkOGMm2EcN5oDa9InL461Isb8+fcjbXD4vqccRfimCEb/EE3o2LRXOTMAg7b C6Y0hda9UXUZ3vsUp3FVWkK/DYNtQKi7RhUc3bDA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Namhyung Kim , Daniel Borkmann , Sasha Levin Subject: [PATCH 5.10 146/221] libbpf: Fix error path in bpf_object__elf_init() Date: Mon, 29 Mar 2021 09:57:57 +0200 Message-Id: <20210329075634.046674312@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210329075629.172032742@linuxfoundation.org> References: <20210329075629.172032742@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Namhyung Kim [ Upstream commit 8f3f5792f2940c16ab63c614b26494c8689c9c1e ] When it failed to get section names, it should call into bpf_object__elf_finish() like others. Fixes: 88a82120282b ("libbpf: Factor out common ELF operations and improve logging") Signed-off-by: Namhyung Kim Signed-off-by: Daniel Borkmann Link: https://lore.kernel.org/bpf/20210317145414.884817-1-namhyung@kernel.org Signed-off-by: Sasha Levin --- tools/lib/bpf/libbpf.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c index b954db52bb80..95eef7ebdac5 100644 --- a/tools/lib/bpf/libbpf.c +++ b/tools/lib/bpf/libbpf.c @@ -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)) { 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 */ -- 2.30.1